@extrahorizon/javascript-sdk 8.10.0-dev-159-0e9a0f1 → 8.10.0-dev-161-c1dd6ca

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 (156) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/build/btoa.d.ts +6 -0
  3. package/build/client.d.ts +147 -0
  4. package/build/constants.d.ts +17 -0
  5. package/build/errorHandler.d.ts +1 -0
  6. package/build/errors.d.ts +361 -0
  7. package/build/http/client.d.ts +2 -0
  8. package/build/http/index.d.ts +4 -0
  9. package/build/http/interceptors.d.ts +9 -0
  10. package/build/http/oAuth1Signature.d.ts +18 -0
  11. package/build/http/oauth1.d.ts +3 -0
  12. package/build/http/oauth2.d.ts +3 -0
  13. package/build/http/proxy.d.ts +3 -0
  14. package/build/http/types.d.ts +331 -0
  15. package/build/http/utils.d.ts +21 -0
  16. package/build/index.cjs.js +1 -1
  17. package/build/index.d.ts +9 -0
  18. package/build/index.mjs +1 -1
  19. package/build/mock.d.ts +43 -0
  20. package/build/mockType.d.ts +1721 -0
  21. package/build/parseStoredCredentials.d.ts +11 -0
  22. package/build/rql/index.d.ts +16 -0
  23. package/build/rql/parser.d.ts +1 -0
  24. package/build/rql/types.d.ts +174 -0
  25. package/build/services/auth/applications/index.d.ts +5 -0
  26. package/build/services/auth/applications/types.d.ts +260 -0
  27. package/build/services/auth/index.d.ts +3 -0
  28. package/build/services/auth/oauth1/index.d.ts +5 -0
  29. package/build/services/auth/oauth1/types.d.ts +102 -0
  30. package/build/services/auth/oauth2/index.d.ts +5 -0
  31. package/build/services/auth/oauth2/types.d.ts +100 -0
  32. package/build/services/auth/oidc/index.d.ts +5 -0
  33. package/build/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  34. package/build/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  35. package/build/services/auth/oidc/providers/index.d.ts +5 -0
  36. package/build/services/auth/oidc/providers/types.d.ts +148 -0
  37. package/build/services/auth/oidc/types.d.ts +40 -0
  38. package/build/services/auth/types.d.ts +39 -0
  39. package/build/services/auth/users/index.d.ts +5 -0
  40. package/build/services/auth/users/types.d.ts +121 -0
  41. package/build/services/configurations/general.d.ts +5 -0
  42. package/build/services/configurations/groups.d.ts +5 -0
  43. package/build/services/configurations/index.d.ts +10 -0
  44. package/build/services/configurations/patients.d.ts +5 -0
  45. package/build/services/configurations/staff.d.ts +5 -0
  46. package/build/services/configurations/types.d.ts +222 -0
  47. package/build/services/configurations/users.d.ts +5 -0
  48. package/build/services/data/comments.d.ts +5 -0
  49. package/build/services/data/documents.d.ts +5 -0
  50. package/build/services/data/index.d.ts +13 -0
  51. package/build/services/data/indexes.d.ts +5 -0
  52. package/build/services/data/infrastructure.d.ts +10 -0
  53. package/build/services/data/json-schema.d.ts +121 -0
  54. package/build/services/data/properties.d.ts +5 -0
  55. package/build/services/data/schemas.d.ts +5 -0
  56. package/build/services/data/statuses.d.ts +5 -0
  57. package/build/services/data/transitions.d.ts +5 -0
  58. package/build/services/data/types.d.ts +1500 -0
  59. package/build/services/dispatchers/actions/index.d.ts +5 -0
  60. package/build/services/dispatchers/actions/types.d.ts +78 -0
  61. package/build/services/dispatchers/dispatchers/index.d.ts +5 -0
  62. package/build/services/dispatchers/dispatchers/types.d.ts +111 -0
  63. package/build/services/dispatchers/index.d.ts +7 -0
  64. package/build/services/dispatchers/types.d.ts +2 -0
  65. package/build/services/events/events.d.ts +5 -0
  66. package/build/services/events/index.d.ts +5 -0
  67. package/build/services/events/subscriptions.d.ts +5 -0
  68. package/build/services/events/types.d.ts +107 -0
  69. package/build/services/files/files.d.ts +5 -0
  70. package/build/services/files/formHelpers.d.ts +3 -0
  71. package/build/services/files/index.d.ts +6 -0
  72. package/build/services/files/settings/index.d.ts +5 -0
  73. package/build/services/files/settings/types.d.ts +38 -0
  74. package/build/services/files/tokens.d.ts +5 -0
  75. package/build/services/files/types.d.ts +185 -0
  76. package/build/services/helpers.d.ts +7 -0
  77. package/build/services/http-client.d.ts +22 -0
  78. package/build/services/index.d.ts +16 -0
  79. package/build/services/localizations/countries.d.ts +5 -0
  80. package/build/services/localizations/index.d.ts +3 -0
  81. package/build/services/localizations/languages.d.ts +5 -0
  82. package/build/services/localizations/localizations.d.ts +5 -0
  83. package/build/services/localizations/types.d.ts +150 -0
  84. package/build/services/logs/access/index.d.ts +5 -0
  85. package/build/services/logs/access/types.d.ts +41 -0
  86. package/build/services/logs/index.d.ts +3 -0
  87. package/build/services/logs/types.d.ts +4 -0
  88. package/build/services/mails/index.d.ts +3 -0
  89. package/build/services/mails/mails.d.ts +5 -0
  90. package/build/services/mails/types.d.ts +149 -0
  91. package/build/services/notifications/index.d.ts +6 -0
  92. package/build/services/notifications/notifications.d.ts +5 -0
  93. package/build/services/notifications/settings.d.ts +5 -0
  94. package/build/services/notifications/types.d.ts +235 -0
  95. package/build/services/notificationsV2/index.d.ts +6 -0
  96. package/build/services/notificationsV2/notificationsV2.d.ts +5 -0
  97. package/build/services/notificationsV2/types.d.ts +166 -0
  98. package/build/services/notificationsV2/userSettings/index.d.ts +5 -0
  99. package/build/services/notificationsV2/userSettings/types.d.ts +138 -0
  100. package/build/services/payments/appStore.d.ts +5 -0
  101. package/build/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/services/payments/health.d.ts +9 -0
  103. package/build/services/payments/index.d.ts +15 -0
  104. package/build/services/payments/orders.d.ts +5 -0
  105. package/build/services/payments/playStore.d.ts +5 -0
  106. package/build/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/services/payments/products.d.ts +5 -0
  109. package/build/services/payments/stripe.d.ts +5 -0
  110. package/build/services/payments/subscriptions.d.ts +5 -0
  111. package/build/services/payments/types.d.ts +1198 -0
  112. package/build/services/profiles/groups.d.ts +5 -0
  113. package/build/services/profiles/index.d.ts +8 -0
  114. package/build/services/profiles/logs.d.ts +5 -0
  115. package/build/services/profiles/profiles.d.ts +5 -0
  116. package/build/services/profiles/types.d.ts +375 -0
  117. package/build/services/tasks/api/index.d.ts +5 -0
  118. package/build/services/tasks/api/types.d.ts +146 -0
  119. package/build/services/tasks/apiRequests/index.d.ts +5 -0
  120. package/build/services/tasks/apiRequests/logs/index.d.ts +5 -0
  121. package/build/services/tasks/apiRequests/logs/types.d.ts +25 -0
  122. package/build/services/tasks/apiRequests/types.d.ts +83 -0
  123. package/build/services/tasks/functions/index.d.ts +5 -0
  124. package/build/services/tasks/functions/types.d.ts +171 -0
  125. package/build/services/tasks/index.d.ts +15 -0
  126. package/build/services/tasks/logs/index.d.ts +5 -0
  127. package/build/services/tasks/logs/types.d.ts +28 -0
  128. package/build/services/tasks/schedules/index.d.ts +5 -0
  129. package/build/services/tasks/schedules/types.d.ts +92 -0
  130. package/build/services/tasks/tasks.d.ts +5 -0
  131. package/build/services/tasks/types.d.ts +118 -0
  132. package/build/services/templates/index.d.ts +3 -0
  133. package/build/services/templates/templates.d.ts +5 -0
  134. package/build/services/templates/types.d.ts +237 -0
  135. package/build/services/templatesV2/index.d.ts +3 -0
  136. package/build/services/templatesV2/templatesV2.d.ts +5 -0
  137. package/build/services/templatesV2/types.d.ts +156 -0
  138. package/build/services/types.d.ts +103 -0
  139. package/build/services/users/activationRequests/index.d.ts +4 -0
  140. package/build/services/users/activationRequests/types.d.ts +70 -0
  141. package/build/services/users/forgotPasswordRequests/index.d.ts +4 -0
  142. package/build/services/users/forgotPasswordRequests/types.d.ts +70 -0
  143. package/build/services/users/globalRoles.d.ts +5 -0
  144. package/build/services/users/groupRoles.d.ts +5 -0
  145. package/build/services/users/index.d.ts +14 -0
  146. package/build/services/users/settings/index.d.ts +4 -0
  147. package/build/services/users/settings/types.d.ts +47 -0
  148. package/build/services/users/types.d.ts +1278 -0
  149. package/build/services/users/users.d.ts +5 -0
  150. package/build/sha1.d.ts +11 -0
  151. package/build/types/services/users/types.d.ts +69 -25
  152. package/build/types/version.d.ts +1 -1
  153. package/build/types.d.ts +104 -0
  154. package/build/utils.d.ts +5 -0
  155. package/build/version.d.ts +1 -0
  156. package/package.json +3 -3
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { LanguagesService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => LanguagesService;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { LocalizationsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => LocalizationsService;
5
+ export default _default;
@@ -0,0 +1,150 @@
1
+ import { RQLString } from '../../rql';
2
+ import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../types';
3
+ export declare enum SupportedLanguageCodes {
4
+ EN = "EN",
5
+ NL = "NL",
6
+ DE = "DE",
7
+ FR = "FR",
8
+ DA = "DA",
9
+ ES = "ES",
10
+ IT = "IT"
11
+ }
12
+ declare type SupportedLanguageCodesValues = keyof typeof SupportedLanguageCodes;
13
+ export declare type MappedText = Record<SupportedLanguageCodesValues, string>;
14
+ export interface Localization {
15
+ key: string;
16
+ text: {
17
+ [K in SupportedLanguageCodesValues]?: string;
18
+ };
19
+ creationTimestamp?: Date;
20
+ updateTimestamp?: Date;
21
+ }
22
+ export interface BulkLocalization {
23
+ localizations?: Array<Pick<Localization, 'key' | 'text'>>;
24
+ }
25
+ /**
26
+ * The 'created' field shows how many new localizations were succesfully created. The 'existing' field shows how many localizations with the given keys already existed. Eventually, the 'existing_ids' fields shows exactly which localizations already existed. Old localizations will not be overwritten by new ones.
27
+ */
28
+ export interface BulkCreationResponse {
29
+ created?: number;
30
+ existing?: number;
31
+ existingIds?: string[];
32
+ }
33
+ /**
34
+ * The 'updated' field shows how many localizations were succesfully updated. The 'missing' field shows how many localizations with the given keys couldn't be found. Eventually, the 'missing_ids' fields shows exactly which localizations couldn't be found and are thus not updated.
35
+ */
36
+ export interface BulkUpdateResponse {
37
+ updated?: number;
38
+ missing?: number;
39
+ missingIds?: string[];
40
+ }
41
+ export interface LocalizationRequest {
42
+ localizationCodes: SupportedLanguageCodesValues[];
43
+ localizations: string[];
44
+ }
45
+ export interface CountriesService {
46
+ /**
47
+ * Retrieve a list of all the defined countries
48
+ *
49
+ * Permission | Scope | Effect
50
+ * - | - | -
51
+ * none | | Everyone can use this endpoint
52
+ * @returns PagedResult<string>
53
+ */
54
+ getCountries(options?: OptionsBase): Promise<string[]>;
55
+ /**
56
+ * Retrieve a list of all the defined regions for the specified country code
57
+ *
58
+ * Permission | Scope | Effect
59
+ * - | - | -
60
+ * none | | Everyone can use this endpoint
61
+ * @param country The country code (as defined in ISO 3166-1)
62
+ * @returns PagedResult<string>
63
+ * @throws {ResourceUnknownError}
64
+ */
65
+ getRegions(country: string, options?: OptionsBase): Promise<string[]>;
66
+ }
67
+ export interface LanguagesService {
68
+ /**
69
+ * Retrieve a list of all the defined languages
70
+ *
71
+ * Permission | Scope | Effect
72
+ * - | - | -
73
+ * none | | Everyone can use this endpoint
74
+ * @returns PagedResult<SupportedLanguageCodes>
75
+ */
76
+ getLanguages(options?: OptionsBase): Promise<string[]>;
77
+ }
78
+ export interface LocalizationsService {
79
+ /**
80
+ * Returns all possible localizations stored in this service
81
+ *
82
+ * Permission | Scope | Effect
83
+ * - | - | -
84
+ * none | | Everyone can use this endpoint
85
+ * @param rql Add filters to the requested list.
86
+ * @returns PagedResult<Localization>
87
+ */
88
+ find(options?: OptionsWithRql): Promise<PagedResult<Localization>>;
89
+ /**
90
+ * Find By Key
91
+ * @param key the key to search for
92
+ * @param rql an optional rql string
93
+ * @returns the first element found
94
+ */
95
+ findByKey(key: string, options?: OptionsWithRql): Promise<Localization | undefined>;
96
+ /**
97
+ * Find First
98
+ * @param rql an optional rql string
99
+ * @returns the first element found
100
+ */
101
+ findFirst(options?: OptionsWithRql): Promise<Localization | undefined>;
102
+ /**
103
+ * Create new localizations
104
+ *
105
+ * Permission | Scope | Effect
106
+ * - | - | -
107
+ * `CREATE_LOCALIZATIONS` | global | **Required** for this endpoint
108
+ * @param requestBody BulkLocalization
109
+ * @returns BulkCreationResponse
110
+ * @throws {DefaultLocalizationMissingError}
111
+ */
112
+ create(requestBody: BulkLocalization, options?: OptionsBase): Promise<BulkCreationResponse>;
113
+ /**
114
+ * Update localizations
115
+ *
116
+ * Permission | Scope | Effect
117
+ * - | - | -
118
+ * `UPDATE_LOCALIZATIONS` | global | **Required** for this endpoint
119
+ * @param requestBody BulkLocalization
120
+ * @returns BulkUpdateResponse
121
+ */
122
+ update(requestBody: BulkLocalization, options?: OptionsBase): Promise<BulkUpdateResponse>;
123
+ /**
124
+ * Delete localizations
125
+ *
126
+ * Permission | Scope | Effect
127
+ * - | - | -
128
+ * `DELETE_LOCALIZATIONS` | global | **Required** for this endpoint
129
+ * @param rql Add filters to the requested list, **required**.
130
+ * @returns AffectedRecords
131
+ */
132
+ remove(rql: RQLString, options?: OptionsBase): Promise<AffectedRecords>;
133
+ /**
134
+ * Request localizations of multiple keys in a specific language
135
+ * The default language (EN) is always included in the response as a fallback in case there is no translation available for the specified language
136
+ *
137
+ * Permission | Scope | Effect
138
+ * - | - | -
139
+ * none | | Everyone can use this endpoint
140
+ * @param requestBody LocalizationRequest
141
+ * @returns Record<string, MappedText>
142
+ */
143
+ getByKeys(requestBody: LocalizationRequest, options?: OptionsBase): Promise<Record<string, MappedText>>;
144
+ /**
145
+ * Perform a health check
146
+ * @returns {boolean} success
147
+ */
148
+ health(): Promise<boolean>;
149
+ }
150
+ export {};
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { LogsAccessService } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => LogsAccessService;
5
+ export default _default;
@@ -0,0 +1,41 @@
1
+ import { OptionsWithRql } from '../../types';
2
+ export interface LogsAccessService {
3
+ /**
4
+ * ## Retrieve a list of access logs
5
+ *
6
+ * **Global Permissions:**
7
+ * - `VIEW_ACCESS_LOGS` - Allows a user to view access logs
8
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
9
+ * @returns An array of access logs {@link AccessLog AccessLog[]}
10
+ */
11
+ find(options?: OptionsWithRql): Promise<AccessLog[]>;
12
+ /**
13
+ * ## Retrieve the first queried access log
14
+ *
15
+ * **Global Permissions:**
16
+ * - `VIEW_ACCESS_LOGS` - Allows a user to view access logs
17
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
18
+ * @returns The first element of the queried access logs {@link AccessLog}
19
+ */
20
+ findFirst(options?: OptionsWithRql): Promise<AccessLog | undefined>;
21
+ }
22
+ export interface AccessLog {
23
+ /** The time of request receival */
24
+ timestamp: Date;
25
+ /** The status code of the response for the request */
26
+ httpStatus: number;
27
+ /** The duration of the request in seconds */
28
+ duration: number;
29
+ /** The Extra Horizon id of the request initiator */
30
+ userId: string;
31
+ /** The IP address of the request's origin */
32
+ userAddress: string;
33
+ /** The domain or IP of the accessed Extra Horizon deployment */
34
+ host: string;
35
+ /** The HTTP request */
36
+ request: string;
37
+ /** The size of the response in Bytes */
38
+ responseBodySize: number;
39
+ /** The signature of the request device and software */
40
+ userAgent: string;
41
+ }
@@ -0,0 +1,3 @@
1
+ import { HttpInstance } from '../../http/types';
2
+ import { LogsService } from './types';
3
+ export declare const logsService: (httpWithAuth: HttpInstance) => LogsService;
@@ -0,0 +1,4 @@
1
+ import { LogsAccessService } from './access/types';
2
+ export interface LogsService {
3
+ access: LogsAccessService;
4
+ }
@@ -0,0 +1,3 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { MailsService } from './types';
3
+ export declare const mailsService: (httpWithAuth: HttpInstance) => MailsService;
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import { MailsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => MailsService;
5
+ export default _default;
@@ -0,0 +1,149 @@
1
+ import { ObjectId, LanguageCode, MailAddress, MailAddressList, MailRecipients, AffectedRecords, PagedResult, OptionsBase, OptionsWithRql, TimeZone } from '../types';
2
+ export interface Mail {
3
+ id: ObjectId;
4
+ creatorId?: ObjectId;
5
+ awsMessageId?: ObjectId;
6
+ subject: string;
7
+ recipients: MailRecipients;
8
+ templateId?: ObjectId;
9
+ templateName?: string;
10
+ replyTo?: MailAddressList;
11
+ from: MailAddress;
12
+ body?: string;
13
+ language?: LanguageCode;
14
+ timeZone?: TimeZone;
15
+ content?: Record<string, any>;
16
+ views: number;
17
+ creationTimestamp: Date;
18
+ updateTimestamp: Date;
19
+ }
20
+ export declare type PlainMailCreation = {
21
+ subject: string;
22
+ body: string;
23
+ } & CommonMailCreationProperties;
24
+ export declare type TemplateBasedMailCreation = {
25
+ templateId?: ObjectId;
26
+ templateName?: string;
27
+ language?: LanguageCode;
28
+ timeZone?: TimeZone;
29
+ content: Record<string, any>;
30
+ } & CommonMailCreationProperties;
31
+ export interface CommonMailCreationProperties {
32
+ recipients: MailRecipients;
33
+ from?: MailAddress;
34
+ replyTo?: MailAddressList;
35
+ attachments?: Attachment[];
36
+ }
37
+ export interface Attachment {
38
+ name: string;
39
+ /**
40
+ * Base64 encoded binary data
41
+ */
42
+ content: string;
43
+ /**
44
+ * MIME Type of the file
45
+ */
46
+ type?: string;
47
+ }
48
+ export interface QueuedMail {
49
+ id: ObjectId;
50
+ status: QueuedMailStatus;
51
+ from: string;
52
+ to?: MailAddressList;
53
+ cc?: MailAddressList;
54
+ bcc?: MailAddressList;
55
+ replyTo?: MailAddress;
56
+ subject?: string;
57
+ text?: string;
58
+ html?: string;
59
+ attachments?: QueuedMailAttachment[];
60
+ encoding?: string;
61
+ textEncoding?: string;
62
+ templateData?: {
63
+ templateId?: ObjectId;
64
+ templateName?: string;
65
+ credentials?: {
66
+ serviceId?: ObjectId;
67
+ applicationId?: ObjectId;
68
+ userId?: ObjectId;
69
+ };
70
+ language?: LanguageCode;
71
+ timeZone?: string;
72
+ content?: Record<string, any>;
73
+ };
74
+ creationTimestamp: Date;
75
+ updateTimestamp: Date;
76
+ }
77
+ export interface QueuedMailAttachment {
78
+ filename?: string;
79
+ content?: string;
80
+ encoding?: string;
81
+ }
82
+ export declare enum QueuedMailStatus {
83
+ QUEUED = "queued",
84
+ SENDING = "sending",
85
+ FAILED = "failed"
86
+ }
87
+ export interface MailsService {
88
+ /**
89
+ * Perform a health check for mail service
90
+ * @returns {boolean} success
91
+ */
92
+ health(options?: OptionsBase): Promise<boolean>;
93
+ /**
94
+ * Retrieve a list of mails
95
+ *
96
+ * Permission | Scope | Effect
97
+ * - | - | -
98
+ * `VIEW_MAILS` | `global` | **Required** for this endpoint
99
+ * @param rql Add filters to the requested list.
100
+ * @returns PagedResult<Mail>
101
+ */
102
+ find: (options?: OptionsWithRql) => Promise<PagedResult<Mail>>;
103
+ /**
104
+ * Find By Id
105
+ * @param id the Id to search for
106
+ * @param rql an optional rql string
107
+ * @returns the first element found
108
+ */
109
+ findById: (id: ObjectId, options?: OptionsWithRql) => Promise<Mail | undefined>;
110
+ /**
111
+ * Find First
112
+ * @param rql an optional rql string
113
+ * @returns the first element found
114
+ */
115
+ findFirst(options?: OptionsWithRql): Promise<Mail | undefined>;
116
+ /**
117
+ * Send a mail
118
+ *
119
+ * Permission | Scope | Effect
120
+ * - | - | -
121
+ * none | | Send mails to your own email address
122
+ * none | `staff enlistment` | Send any mail to your patients or send a template mail based on pre-configured allowed templates to any email address.
123
+ * `SEND_MAILS` | `global` | Send mails to any email address
124
+ * @param requestBody mail creation data
125
+ * @returns Mail
126
+ * @throws {NotActivatedError}
127
+ */
128
+ send(requestBody: PlainMailCreation | TemplateBasedMailCreation, options?: OptionsBase): Promise<Mail>;
129
+ /**
130
+ * Register a mail being opened
131
+ *
132
+ * Permission | Scope | Effect
133
+ * - | - | -
134
+ * none | | Everyone can use this endpoint
135
+ * @param trackingHash
136
+ * @returns AffectedRecords
137
+ */
138
+ track(trackingHash: string, options?: OptionsBase): Promise<AffectedRecords>;
139
+ /**
140
+ * Retrieve the list of mails that are not sent yet
141
+ *
142
+ * Permission | Scope | Effect
143
+ * - | - | -
144
+ * `VIEW_MAILS` | `global` | **Required** for this endpoint
145
+ * @param rql Add filters to the requested list.
146
+ * @returns PagedResult<QueuedMail>
147
+ */
148
+ findOutbound(options?: OptionsWithRql): Promise<PagedResult<QueuedMail>>;
149
+ }
@@ -0,0 +1,6 @@
1
+ import type { AuthHttpClient } from '../../types';
2
+ import settings from './settings';
3
+ import { NotificationSettingsServices, NotificationsService } from './types';
4
+ export declare const notificationsService: (httpWithAuth: AuthHttpClient) => NotificationsService & {
5
+ settings: NotificationSettingsServices;
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { AuthHttpClient } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import { NotificationsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: AuthHttpClient) => NotificationsService;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { NotificationSettingsServices } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => NotificationSettingsServices;
5
+ export default _default;
@@ -0,0 +1,235 @@
1
+ import { FindAllIterator } from '../../services/helpers';
2
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult, PagedResultWithPager } from '../types';
3
+ export interface Notification {
4
+ id?: ObjectId;
5
+ type?: string;
6
+ viewed?: boolean;
7
+ userId?: ObjectId;
8
+ fields?: Record<string, string>;
9
+ important?: boolean;
10
+ creationTimestamp?: Date;
11
+ updateTimestamp?: Date;
12
+ }
13
+ interface CreateNotificationRequestBase {
14
+ userId?: ObjectId;
15
+ important?: boolean;
16
+ }
17
+ interface CreateNotificationRequestMessage extends CreateNotificationRequestBase {
18
+ type: 'message';
19
+ fields: {
20
+ title: string;
21
+ body: string;
22
+ };
23
+ }
24
+ interface CreateNotificationRequestLink extends CreateNotificationRequestBase {
25
+ type: 'link';
26
+ fields: {
27
+ title: string;
28
+ body: string;
29
+ url: string;
30
+ };
31
+ }
32
+ interface CreateNotificationRequestMeasurementComment extends CreateNotificationRequestBase {
33
+ type: 'measurement_comment';
34
+ fields: {
35
+ commenterId: ObjectId;
36
+ measurementId: ObjectId;
37
+ };
38
+ }
39
+ interface CreateNotificationRequestMeasurementReviewed extends CreateNotificationRequestBase {
40
+ type: 'measurement_reviewed';
41
+ fields: {
42
+ measurementId: ObjectId;
43
+ };
44
+ }
45
+ interface CreateNotificationRequestMeasurementPrescriptionExpiry extends CreateNotificationRequestBase {
46
+ type: 'prescription_expiry';
47
+ fields: {
48
+ groupId: ObjectId;
49
+ groupName: string;
50
+ };
51
+ }
52
+ interface CreateNotificationRequestActivated extends CreateNotificationRequestBase {
53
+ type: 'activated';
54
+ }
55
+ interface CreateNotificationRequestPasswordChanged extends CreateNotificationRequestBase {
56
+ type: 'password_changed';
57
+ }
58
+ export declare type CreateNotificationRequest = CreateNotificationRequestMessage | CreateNotificationRequestLink | CreateNotificationRequestMeasurementComment | CreateNotificationRequestMeasurementReviewed | CreateNotificationRequestMeasurementPrescriptionExpiry | CreateNotificationRequestActivated | CreateNotificationRequestPasswordChanged;
59
+ export interface NotifTypeDef {
60
+ name?: string;
61
+ requiredFields?: Record<string, FieldType>;
62
+ optionalFields?: Record<string, {
63
+ fieldType?: FieldType;
64
+ defaultValue?: string;
65
+ }>;
66
+ title?: string;
67
+ body?: string;
68
+ combinedBody?: string;
69
+ pushByDefault?: boolean;
70
+ }
71
+ export declare enum FieldType {
72
+ STRING = "STRING",
73
+ NUMBER = "NUMBER",
74
+ BOOLEAN = "BOOLEAN",
75
+ OBJECT_ID = "OBJECT_ID",
76
+ URL = "URL"
77
+ }
78
+ export interface NotificationSettings {
79
+ id?: ObjectId;
80
+ key?: string;
81
+ preferences?: {
82
+ passwordChanged?: boolean;
83
+ activated?: boolean;
84
+ prescriptionExpiry?: boolean;
85
+ measurementComment?: boolean;
86
+ measurementReviewed?: boolean;
87
+ message?: boolean;
88
+ link?: boolean;
89
+ };
90
+ creationTimestamp?: Date;
91
+ updateTimestamp?: Date;
92
+ }
93
+ export declare type SettingCreation = Required<Pick<NotificationSettings, 'key' | 'preferences'>>;
94
+ export interface NotificationsService {
95
+ /**
96
+ * Create a notification
97
+ *
98
+ * Permission | Scope | Effect
99
+ * - | - | -
100
+ * none | | Create a notification for yourself
101
+ * `CREATE_NOTIFICATIONS` | `global` | Create a notification for another person
102
+ * @param requestBody CreateNotificationRequest
103
+ * @returns Notification
104
+ */
105
+ create(requestBody: CreateNotificationRequest, options?: OptionsBase): Promise<Notification>;
106
+ /**
107
+ * Retrieve a list of notifications
108
+ *
109
+ * Permission | Scope | Effect
110
+ * - | - | -
111
+ * none | | View your own notifications
112
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
113
+ * @param rql Add filters to the requested list.
114
+ * @returns PagedResult<Notification>
115
+ */
116
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<Notification>>;
117
+ /**
118
+ * Request a list of all notifications
119
+ *
120
+ * Do not pass in an rql with limit operator!
121
+ *
122
+ * Permission | Scope | Effect
123
+ * - | - | -
124
+ * none | | View your own notifications
125
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
126
+ * @returns Notification[]
127
+ */
128
+ findAll(options?: OptionsWithRql): Promise<Notification[]>;
129
+ /**
130
+ * Request a list of all notifications
131
+ *
132
+ * Permission | Scope | Effect
133
+ * - | - | -
134
+ * none | | View your own notifications
135
+ * `VIEW_NOTIFICATIONS` | `global` | View all notifications
136
+ * @returns Notification[]
137
+ */
138
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Notification>;
139
+ /**
140
+ * Find By Id
141
+ * @param id the Id to search for
142
+ * @param rql an optional rql string
143
+ * @returns the first element found
144
+ */
145
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Notification | undefined>;
146
+ /**
147
+ * Find First
148
+ * @param rql an optional rql string
149
+ * @returns the first element found
150
+ */
151
+ findFirst(options?: OptionsWithRql): Promise<Notification | undefined>;
152
+ /**
153
+ * Delete notification(s)
154
+ *
155
+ * Permission | Scope | Effect
156
+ * - | - | -
157
+ * `DELETE_NOTIFICATIONS` | `global` | **Required** for this endpoint
158
+ * @param rql Add filters to the requested list.
159
+ * @returns AffectedRecords
160
+ */
161
+ remove(options?: OptionsWithRql): Promise<AffectedRecords>;
162
+ /**
163
+ * Mark your notification(s) as viewed
164
+ *
165
+ * Permission | Scope | Effect
166
+ * - | - | -
167
+ * none | | Everyone can use this endpoint
168
+ * @param rql Add filters to the requested list.
169
+ * @returns AffectedRecords
170
+ */
171
+ markAsViewed(options?: OptionsWithRql): Promise<AffectedRecords>;
172
+ /**
173
+ * Retrieve the list of notification types
174
+ *
175
+ * Permission | Scope | Effect
176
+ * - | - | -
177
+ * none | | Everyone can use this endpoint
178
+ * @returns PagedResult<NotifTypeDef>
179
+ */
180
+ getTypes(options?: OptionsBase): Promise<PagedResult<NotifTypeDef>>;
181
+ /**
182
+ * Perform a health check
183
+ * @returns {boolean} success
184
+ */
185
+ health(): Promise<boolean>;
186
+ }
187
+ export interface NotificationSettingsServices {
188
+ /**
189
+ * Retrieve a list of notifications settings
190
+ *
191
+ * Permission | Scope | Effect
192
+ * - | - | -
193
+ * none | | View your own notification settings
194
+ * `VIEW_NOTIFICATION_SETTINGS` | `global` | View all notification settings
195
+ * @param rql Add filters to the requested list.
196
+ * @returns PagedResult<Setting>
197
+ */
198
+ find(options?: OptionsWithRql): Promise<PagedResult<NotificationSettings>>;
199
+ /**
200
+ * Find By Id
201
+ * @param id the Id to search for
202
+ * @param rql an optional rql string
203
+ * @returns the first element found
204
+ */
205
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<NotificationSettings | undefined>;
206
+ /**
207
+ * Find First
208
+ * @param rql an optional rql string
209
+ * @returns the first element found
210
+ */
211
+ findFirst(options?: OptionsWithRql): Promise<NotificationSettings | undefined>;
212
+ /**
213
+ * Update the notification settings for a user
214
+ *
215
+ * Permission | Scope | Effect
216
+ * - | - | -
217
+ * none | | Update your own notification settings
218
+ * `UPDATE_NOTIFICATION_SETTINGS` | `global` | Update all notification settings
219
+ * @param userId The User Id
220
+ * @param requestBody SettingCreation object
221
+ * @returns Setting
222
+ */
223
+ update(userId: string, requestBody: SettingCreation, options?: OptionsBase): Promise<NotificationSettings>;
224
+ /**
225
+ * Delete the notifications settings for a user
226
+ *
227
+ * Permission | Scope | Effect
228
+ * - | - | -
229
+ * `UPDATE_NOTIFICATION_SETTINGS` | `global` | **Required** for this endpoint
230
+ * @param userId
231
+ * @returns AffectedRecords
232
+ */
233
+ remove(userId: string, options?: OptionsBase): Promise<AffectedRecords>;
234
+ }
235
+ export {};
@@ -0,0 +1,6 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import { NotificationV2Service } from './types';
3
+ import { NotificationV2UserSettingsService } from './userSettings/types';
4
+ export declare const notificationsV2Service: (httpWithAuth: AuthHttpClient) => NotificationV2Service & {
5
+ userSettings: NotificationV2UserSettingsService;
6
+ };
@@ -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;