@extrahorizon/javascript-sdk 8.5.0-dev-79-c67d6f6 → 8.5.0-feat-82-38b4e34

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.
@@ -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';
@@ -4214,7 +4215,7 @@ var groupRoles = (client, httpWithAuth) => ({
4214
4215
  },
4215
4216
  });
4216
4217
 
4217
- var health$5 = (userClient, http) => ({
4218
+ var health$6 = (userClient, http) => ({
4218
4219
  /**
4219
4220
  * Perform a health check
4220
4221
  * @returns {boolean} success
@@ -4411,7 +4412,7 @@ const usersService = (httpWithAuth, http) => {
4411
4412
  basePath: USER_BASE,
4412
4413
  transformRequestData: decamelizeRequestData,
4413
4414
  });
4414
- const healthMethods = health$5(userClient, httpWithAuth);
4415
+ const healthMethods = health$6(userClient, httpWithAuth);
4415
4416
  const usersMethods = users$1(userClient, httpWithAuth, http);
4416
4417
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4417
4418
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4792,7 +4793,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4792
4793
  },
4793
4794
  });
4794
4795
 
4795
- var health$4 = (client, httpAuth) => ({
4796
+ var health$5 = (client, httpAuth) => ({
4796
4797
  /**
4797
4798
  * Check if the service is available
4798
4799
  * @returns true if service is up and running
@@ -4998,7 +4999,7 @@ const paymentsService = (httpWithAuth) => {
4998
4999
  basePath: PAYMENTS_BASE,
4999
5000
  });
5000
5001
  return {
5001
- ...health$4(client, httpWithAuth),
5002
+ ...health$5(client, httpWithAuth),
5002
5003
  products: products(client, httpWithAuth),
5003
5004
  orders: orders(client, httpWithAuth),
5004
5005
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -5020,7 +5021,7 @@ var countries = (client, httpAuth) => ({
5020
5021
  },
5021
5022
  });
5022
5023
 
5023
- var health$3 = (client, http) => ({
5024
+ var health$4 = (client, http) => ({
5024
5025
  /**
5025
5026
  * Perform a health check
5026
5027
  * @returns {boolean} success
@@ -5073,7 +5074,7 @@ const localizationsService = (httpWithAuth) => {
5073
5074
  basePath: LOCALIZATIONS_BASE,
5074
5075
  });
5075
5076
  return {
5076
- ...health$3(client, httpWithAuth),
5077
+ ...health$4(client, httpWithAuth),
5077
5078
  ...localizations(client, httpWithAuth),
5078
5079
  ...countries(client, httpWithAuth),
5079
5080
  ...languages(client, httpWithAuth),
@@ -5098,7 +5099,7 @@ var groups = (client, httpAuth) => ({
5098
5099
  },
5099
5100
  });
5100
5101
 
5101
- var health$2 = (client, httpAuth) => ({
5102
+ var health$3 = (client, httpAuth) => ({
5102
5103
  /**
5103
5104
  * Perform a health check for profiles service
5104
5105
  * @returns {boolean} success
@@ -5188,14 +5189,14 @@ const profilesService = (httpWithAuth) => {
5188
5189
  basePath: PROFILES_BASE,
5189
5190
  });
5190
5191
  return {
5191
- ...health$2(client, httpWithAuth),
5192
+ ...health$3(client, httpWithAuth),
5192
5193
  ...profiles(client, httpWithAuth),
5193
5194
  groups: groups(client, httpWithAuth),
5194
5195
  logs: logs(client, httpWithAuth),
5195
5196
  };
5196
5197
  };
5197
5198
 
5198
- var health$1 = (client, http) => ({
5199
+ var health$2 = (client, http) => ({
5199
5200
  /**
5200
5201
  * Perform a health check
5201
5202
  * @returns {boolean} success
@@ -5282,12 +5283,103 @@ const notificationsService = (httpWithAuth) => {
5282
5283
  transformRequestData: decamelizeRequestData,
5283
5284
  });
5284
5285
  return {
5285
- ...health$1(client, httpWithAuth),
5286
+ ...health$2(client, httpWithAuth),
5286
5287
  ...notifications(client, httpWithAuth),
5287
5288
  settings: settings(client, httpWithAuth),
5288
5289
  };
5289
5290
  };
5290
5291
 
5292
+ var health$1 = (client, http) => ({
5293
+ /**
5294
+ * Perform a health check
5295
+ * @returns {boolean} success
5296
+ */
5297
+ async health() {
5298
+ const result = await client.get(http, '/health');
5299
+ return result.status === exports.Results.Success;
5300
+ },
5301
+ });
5302
+
5303
+ var notificationsV2 = (client, httpWithAuth) => {
5304
+ async function find(options) {
5305
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5306
+ ...options,
5307
+ customResponseKeys: ['data.data'],
5308
+ });
5309
+ return result.data;
5310
+ }
5311
+ return {
5312
+ async create(requestBody, options) {
5313
+ const result = await client.post(httpWithAuth, '/', requestBody, {
5314
+ ...options,
5315
+ customKeys: ['data'],
5316
+ });
5317
+ return result.data;
5318
+ },
5319
+ async find(options) {
5320
+ const result = await find(options);
5321
+ return addPagersFn(find, options, result);
5322
+ },
5323
+ async findAll(options) {
5324
+ return findAllGeneric(find, options);
5325
+ },
5326
+ async findByTargetUserId(targetUserId, options) {
5327
+ const rqlWithTargetUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('targetUserId', targetUserId).build();
5328
+ const result = await find({ ...options, rql: rqlWithTargetUserId });
5329
+ return addPagersFn(find, { ...options, rql: rqlWithTargetUserId }, result);
5330
+ },
5331
+ async findFirst(options) {
5332
+ const result = await find(options);
5333
+ return result.data[0];
5334
+ },
5335
+ async findById(notificationId, options) {
5336
+ const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5337
+ const result = await find({ ...options, rql: rqlWithNotificationId });
5338
+ return result.data[0];
5339
+ },
5340
+ };
5341
+ };
5342
+
5343
+ var notificationV2Users = (client, httpWithAuth) => {
5344
+ async function find(options) {
5345
+ const result = await client.get(httpWithAuth, `/users/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
5346
+ return result.data;
5347
+ }
5348
+ return {
5349
+ async update(userId, requestBody, options) {
5350
+ const result = await client.put(httpWithAuth, `/users/${userId}`, requestBody, options);
5351
+ return result.data;
5352
+ },
5353
+ async find(options) {
5354
+ const result = await find(options);
5355
+ return addPagersFn(find, options, result);
5356
+ },
5357
+ async findAll(options) {
5358
+ return findAllGeneric(find, options);
5359
+ },
5360
+ async findByUserId(userId, options) {
5361
+ const rqlWithUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', userId).build();
5362
+ const result = await find({ ...options, rql: rqlWithUserId });
5363
+ return result.data[0];
5364
+ },
5365
+ async findFirst(options) {
5366
+ const result = await find(options);
5367
+ return result.data[0];
5368
+ },
5369
+ };
5370
+ };
5371
+
5372
+ const notificationsV2Service = (httpWithAuth) => {
5373
+ const client = httpClient({
5374
+ basePath: NOTIFICATIONS_V2_BASE,
5375
+ });
5376
+ return {
5377
+ ...health$1(client, httpWithAuth),
5378
+ ...notificationsV2(client, httpWithAuth),
5379
+ users: notificationV2Users(client, httpWithAuth),
5380
+ };
5381
+ };
5382
+
5291
5383
  var events = (client, httpAuth) => ({
5292
5384
  async find(options) {
5293
5385
  return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`)).data;
@@ -5380,7 +5472,7 @@ const logsService = (httpWithAuth) => {
5380
5472
  };
5381
5473
  };
5382
5474
 
5383
- const version = '8.5.0-dev-79-c67d6f6';
5475
+ const version = '8.5.0-feat-82-38b4e34';
5384
5476
 
5385
5477
  /**
5386
5478
  * Create ExtraHorizon client.
@@ -5420,6 +5512,7 @@ function createClient(rawConfig) {
5420
5512
  localizations: localizationsService(httpWithAuth),
5421
5513
  profiles: profilesService(httpWithAuth),
5422
5514
  notifications: notificationsService(httpWithAuth),
5515
+ notificationsV2: notificationsV2Service(httpWithAuth),
5423
5516
  events: eventsService(httpWithAuth),
5424
5517
  logs: logsService(httpWithAuth),
5425
5518
  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';
@@ -4184,7 +4185,7 @@ var groupRoles = (client, httpWithAuth) => ({
4184
4185
  },
4185
4186
  });
4186
4187
 
4187
- var health$5 = (userClient, http) => ({
4188
+ var health$6 = (userClient, http) => ({
4188
4189
  /**
4189
4190
  * Perform a health check
4190
4191
  * @returns {boolean} success
@@ -4381,7 +4382,7 @@ const usersService = (httpWithAuth, http) => {
4381
4382
  basePath: USER_BASE,
4382
4383
  transformRequestData: decamelizeRequestData,
4383
4384
  });
4384
- const healthMethods = health$5(userClient, httpWithAuth);
4385
+ const healthMethods = health$6(userClient, httpWithAuth);
4385
4386
  const usersMethods = users$1(userClient, httpWithAuth, http);
4386
4387
  const groupRolesMethods = groupRoles(userClient, httpWithAuth);
4387
4388
  const globalRolesMethods = globalRoles(userClient, httpWithAuth);
@@ -4762,7 +4763,7 @@ var appStoreSubscriptions = (client, httpAuth) => ({
4762
4763
  },
4763
4764
  });
4764
4765
 
4765
- var health$4 = (client, httpAuth) => ({
4766
+ var health$5 = (client, httpAuth) => ({
4766
4767
  /**
4767
4768
  * Check if the service is available
4768
4769
  * @returns true if service is up and running
@@ -4968,7 +4969,7 @@ const paymentsService = (httpWithAuth) => {
4968
4969
  basePath: PAYMENTS_BASE,
4969
4970
  });
4970
4971
  return {
4971
- ...health$4(client, httpWithAuth),
4972
+ ...health$5(client, httpWithAuth),
4972
4973
  products: products(client, httpWithAuth),
4973
4974
  orders: orders(client, httpWithAuth),
4974
4975
  subscriptions: subscriptions$1(client, httpWithAuth),
@@ -4990,7 +4991,7 @@ var countries = (client, httpAuth) => ({
4990
4991
  },
4991
4992
  });
4992
4993
 
4993
- var health$3 = (client, http) => ({
4994
+ var health$4 = (client, http) => ({
4994
4995
  /**
4995
4996
  * Perform a health check
4996
4997
  * @returns {boolean} success
@@ -5043,7 +5044,7 @@ const localizationsService = (httpWithAuth) => {
5043
5044
  basePath: LOCALIZATIONS_BASE,
5044
5045
  });
5045
5046
  return {
5046
- ...health$3(client, httpWithAuth),
5047
+ ...health$4(client, httpWithAuth),
5047
5048
  ...localizations(client, httpWithAuth),
5048
5049
  ...countries(client, httpWithAuth),
5049
5050
  ...languages(client, httpWithAuth),
@@ -5068,7 +5069,7 @@ var groups = (client, httpAuth) => ({
5068
5069
  },
5069
5070
  });
5070
5071
 
5071
- var health$2 = (client, httpAuth) => ({
5072
+ var health$3 = (client, httpAuth) => ({
5072
5073
  /**
5073
5074
  * Perform a health check for profiles service
5074
5075
  * @returns {boolean} success
@@ -5158,14 +5159,14 @@ const profilesService = (httpWithAuth) => {
5158
5159
  basePath: PROFILES_BASE,
5159
5160
  });
5160
5161
  return {
5161
- ...health$2(client, httpWithAuth),
5162
+ ...health$3(client, httpWithAuth),
5162
5163
  ...profiles(client, httpWithAuth),
5163
5164
  groups: groups(client, httpWithAuth),
5164
5165
  logs: logs(client, httpWithAuth),
5165
5166
  };
5166
5167
  };
5167
5168
 
5168
- var health$1 = (client, http) => ({
5169
+ var health$2 = (client, http) => ({
5169
5170
  /**
5170
5171
  * Perform a health check
5171
5172
  * @returns {boolean} success
@@ -5252,12 +5253,103 @@ const notificationsService = (httpWithAuth) => {
5252
5253
  transformRequestData: decamelizeRequestData,
5253
5254
  });
5254
5255
  return {
5255
- ...health$1(client, httpWithAuth),
5256
+ ...health$2(client, httpWithAuth),
5256
5257
  ...notifications(client, httpWithAuth),
5257
5258
  settings: settings(client, httpWithAuth),
5258
5259
  };
5259
5260
  };
5260
5261
 
5262
+ var health$1 = (client, http) => ({
5263
+ /**
5264
+ * Perform a health check
5265
+ * @returns {boolean} success
5266
+ */
5267
+ async health() {
5268
+ const result = await client.get(http, '/health');
5269
+ return result.status === Results.Success;
5270
+ },
5271
+ });
5272
+
5273
+ var notificationsV2 = (client, httpWithAuth) => {
5274
+ async function find(options) {
5275
+ const result = await client.get(httpWithAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, {
5276
+ ...options,
5277
+ customResponseKeys: ['data.data'],
5278
+ });
5279
+ return result.data;
5280
+ }
5281
+ return {
5282
+ async create(requestBody, options) {
5283
+ const result = await client.post(httpWithAuth, '/', requestBody, {
5284
+ ...options,
5285
+ customKeys: ['data'],
5286
+ });
5287
+ return result.data;
5288
+ },
5289
+ async find(options) {
5290
+ const result = await find(options);
5291
+ return addPagersFn(find, options, result);
5292
+ },
5293
+ async findAll(options) {
5294
+ return findAllGeneric(find, options);
5295
+ },
5296
+ async findByTargetUserId(targetUserId, options) {
5297
+ const rqlWithTargetUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('targetUserId', targetUserId).build();
5298
+ const result = await find({ ...options, rql: rqlWithTargetUserId });
5299
+ return addPagersFn(find, { ...options, rql: rqlWithTargetUserId }, result);
5300
+ },
5301
+ async findFirst(options) {
5302
+ const result = await find(options);
5303
+ return result.data[0];
5304
+ },
5305
+ async findById(notificationId, options) {
5306
+ const rqlWithNotificationId = rqlBuilder().eq('id', notificationId).build();
5307
+ const result = await find({ ...options, rql: rqlWithNotificationId });
5308
+ return result.data[0];
5309
+ },
5310
+ };
5311
+ };
5312
+
5313
+ var notificationV2Users = (client, httpWithAuth) => {
5314
+ async function find(options) {
5315
+ const result = await client.get(httpWithAuth, `/users/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
5316
+ return result.data;
5317
+ }
5318
+ return {
5319
+ async update(userId, requestBody, options) {
5320
+ const result = await client.put(httpWithAuth, `/users/${userId}`, requestBody, options);
5321
+ return result.data;
5322
+ },
5323
+ async find(options) {
5324
+ const result = await find(options);
5325
+ return addPagersFn(find, options, result);
5326
+ },
5327
+ async findAll(options) {
5328
+ return findAllGeneric(find, options);
5329
+ },
5330
+ async findByUserId(userId, options) {
5331
+ const rqlWithUserId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', userId).build();
5332
+ const result = await find({ ...options, rql: rqlWithUserId });
5333
+ return result.data[0];
5334
+ },
5335
+ async findFirst(options) {
5336
+ const result = await find(options);
5337
+ return result.data[0];
5338
+ },
5339
+ };
5340
+ };
5341
+
5342
+ const notificationsV2Service = (httpWithAuth) => {
5343
+ const client = httpClient({
5344
+ basePath: NOTIFICATIONS_V2_BASE,
5345
+ });
5346
+ return {
5347
+ ...health$1(client, httpWithAuth),
5348
+ ...notificationsV2(client, httpWithAuth),
5349
+ users: notificationV2Users(client, httpWithAuth),
5350
+ };
5351
+ };
5352
+
5261
5353
  var events = (client, httpAuth) => ({
5262
5354
  async find(options) {
5263
5355
  return (await client.get(httpAuth, `/${(options === null || options === void 0 ? void 0 : options.rql) || ''}`)).data;
@@ -5350,7 +5442,7 @@ const logsService = (httpWithAuth) => {
5350
5442
  };
5351
5443
  };
5352
5444
 
5353
- const version = '8.5.0-dev-79-c67d6f6';
5445
+ const version = '8.5.0-feat-82-38b4e34';
5354
5446
 
5355
5447
  /**
5356
5448
  * Create ExtraHorizon client.
@@ -5390,6 +5482,7 @@ function createClient(rawConfig) {
5390
5482
  localizations: localizationsService(httpWithAuth),
5391
5483
  profiles: profilesService(httpWithAuth),
5392
5484
  notifications: notificationsService(httpWithAuth),
5485
+ notificationsV2: notificationsV2Service(httpWithAuth),
5393
5486
  events: eventsService(httpWithAuth),
5394
5487
  logs: logsService(httpWithAuth),
5395
5488
  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";
@@ -424,6 +424,22 @@ export declare type MockClientOAuth1<MockFn> = {
424
424
  remove: MockFn;
425
425
  };
426
426
  };
427
+ notificationsV2: {
428
+ health: MockFn;
429
+ create: MockFn;
430
+ find: MockFn;
431
+ findAll: MockFn;
432
+ findByTargetUserId: MockFn;
433
+ findFirst: MockFn;
434
+ findById: MockFn;
435
+ users: {
436
+ update: MockFn;
437
+ find: MockFn;
438
+ findAll: MockFn;
439
+ findByUserId: MockFn;
440
+ findFirst: MockFn;
441
+ };
442
+ };
427
443
  events: {
428
444
  health: MockFn;
429
445
  find: MockFn;
@@ -955,6 +971,22 @@ export declare type MockClientOAuth2<MockFn> = {
955
971
  remove: MockFn;
956
972
  };
957
973
  };
974
+ notificationsV2: {
975
+ health: MockFn;
976
+ create: MockFn;
977
+ find: MockFn;
978
+ findAll: MockFn;
979
+ findByTargetUserId: MockFn;
980
+ findFirst: MockFn;
981
+ findById: MockFn;
982
+ users: {
983
+ update: MockFn;
984
+ find: MockFn;
985
+ findAll: MockFn;
986
+ findByUserId: MockFn;
987
+ findFirst: MockFn;
988
+ };
989
+ };
958
990
  events: {
959
991
  health: MockFn;
960
992
  find: MockFn;
@@ -1486,6 +1518,22 @@ export declare type MockClientProxy<MockFn> = {
1486
1518
  remove: MockFn;
1487
1519
  };
1488
1520
  };
1521
+ notificationsV2: {
1522
+ health: MockFn;
1523
+ create: MockFn;
1524
+ find: MockFn;
1525
+ findAll: MockFn;
1526
+ findByTargetUserId: MockFn;
1527
+ findFirst: MockFn;
1528
+ findById: MockFn;
1529
+ users: {
1530
+ update: MockFn;
1531
+ find: MockFn;
1532
+ findAll: MockFn;
1533
+ findByUserId: MockFn;
1534
+ findFirst: MockFn;
1535
+ };
1536
+ };
1489
1537
  events: {
1490
1538
  health: MockFn;
1491
1539
  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,97 @@
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
+ export interface NotificationV2<T extends Record<string, string> = Record<string, string>> extends NotificationV2Creation<T> {
10
+ id: ObjectId;
11
+ creatorId: ObjectId;
12
+ sent: boolean;
13
+ creationTimestamp: Date;
14
+ updateTimestamp: Date;
15
+ }
16
+ export interface NotificationV2Service {
17
+ /**
18
+ * # Create a notification
19
+ *
20
+ * ## Access via permissions
21
+ * Permission | Scopes | Effect
22
+ * - | - | -
23
+ * `CREATE_NOTIFICATIONS` | `global` | Create notifications for any user
24
+ * `CREATE_NOTIFICATIONS` | `group` | Create notifications for any patient in group
25
+ * none | | Create notifications for yourself
26
+ *
27
+ * # Interface
28
+ * @param requestBody
29
+ * @param options
30
+ * @returns NotificationV2<T>
31
+ */
32
+ create<T extends Record<string, string>>(requestBody: NotificationV2Creation<T>, options?: OptionsBase): Promise<NotificationV2<T>>;
33
+ /**
34
+ * # Request a list of notifications
35
+ *
36
+ * ## Access via permissions
37
+ * Permission | Scopes | Effect
38
+ * - | - | -
39
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
40
+ *
41
+ * # Interface
42
+ * @returns PagedResultWithPager<NotificationV2<T>>
43
+ */
44
+ find<T extends Record<string, string>>(options?: OptionsWithRql): Promise<PagedResultWithPager<NotificationV2<T>>>;
45
+ /**
46
+ * # Request a list of notifications
47
+ *
48
+ * Do not pass in an rql with limit operator!
49
+ *
50
+ * ## Access via permissions
51
+ * Permission | Scopes | Effect
52
+ * - | - | -
53
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
54
+ *
55
+ * # Interface
56
+ * @returns NotificationV2<T>[]
57
+ */
58
+ findAll<T extends Record<string, string>>(options?: OptionsWithRql): Promise<NotificationV2<T>[]>;
59
+ /**
60
+ * # Request a list of notifications created for a user
61
+ *
62
+ * ## Access via permissions
63
+ * Permission | Scopes | Effect
64
+ * - | - | -
65
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
66
+ *
67
+ * # Interface
68
+ * @param targetUserId the user id to search for
69
+ * @returns PagedResultWithPager<NotificationV2<T>>
70
+ */
71
+ findByTargetUserId<T extends Record<string, string>>(targetUserId: ObjectId, options?: OptionsWithRql): Promise<PagedResultWithPager<NotificationV2<T>>>;
72
+ /**
73
+ * # Request the first notification found
74
+ *
75
+ * ## Access via permissions
76
+ * Permission | Scopes | Effect
77
+ * - | - | -
78
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
79
+ *
80
+ * # Interface
81
+ * @returns NotificationV2<T> | undefined
82
+ */
83
+ findFirst<T extends Record<string, string>>(options?: OptionsWithRql): Promise<NotificationV2<T> | undefined>;
84
+ /**
85
+ * # Request a notification by id
86
+ *
87
+ * ## Access via permissions
88
+ * Permission | Scopes | Effect
89
+ * - | - | -
90
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
91
+ *
92
+ * # Interface
93
+ * @param notificationId the Id to search for
94
+ * @returns NotificationV2<T> | undefined
95
+ */
96
+ findById<T extends Record<string, string>>(notificationId: ObjectId, options?: OptionsBase): Promise<NotificationV2<T> | undefined>;
97
+ }
@@ -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.5.0-dev-79-c67d6f6";
1
+ export declare const version = "8.5.0-feat-82-38b4e34";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.5.0-dev-79-c67d6f6",
3
+ "version": "8.5.0-feat-82-38b4e34",
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",