@extrahorizon/javascript-sdk 8.2.0-test

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 (153) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -0
  4. package/build/index.cjs.js +1 -0
  5. package/build/index.mjs +1 -0
  6. package/build/types/btoa.d.ts +6 -0
  7. package/build/types/client.d.ts +136 -0
  8. package/build/types/constants.d.ts +15 -0
  9. package/build/types/errorHandler.d.ts +2 -0
  10. package/build/types/errors.d.ts +332 -0
  11. package/build/types/http/client.d.ts +2 -0
  12. package/build/types/http/index.d.ts +4 -0
  13. package/build/types/http/interceptors.d.ts +9 -0
  14. package/build/types/http/oAuth1Signature.d.ts +14 -0
  15. package/build/types/http/oauth1.d.ts +3 -0
  16. package/build/types/http/oauth2.d.ts +3 -0
  17. package/build/types/http/proxy.d.ts +3 -0
  18. package/build/types/http/types.d.ts +331 -0
  19. package/build/types/http/utils.d.ts +21 -0
  20. package/build/types/index.d.ts +9 -0
  21. package/build/types/mock.d.ts +43 -0
  22. package/build/types/mockType.d.ts +1511 -0
  23. package/build/types/parseStoredCredentials.d.ts +11 -0
  24. package/build/types/rql/index.d.ts +16 -0
  25. package/build/types/rql/parser.d.ts +1 -0
  26. package/build/types/rql/types.d.ts +168 -0
  27. package/build/types/services/auth/applications/index.d.ts +5 -0
  28. package/build/types/services/auth/applications/types.d.ts +190 -0
  29. package/build/types/services/auth/index.d.ts +3 -0
  30. package/build/types/services/auth/oauth1/index.d.ts +5 -0
  31. package/build/types/services/auth/oauth1/types.d.ts +63 -0
  32. package/build/types/services/auth/oauth2/index.d.ts +5 -0
  33. package/build/types/services/auth/oauth2/types.d.ts +52 -0
  34. package/build/types/services/auth/oidc/index.d.ts +5 -0
  35. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  36. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  37. package/build/types/services/auth/oidc/providers/index.d.ts +5 -0
  38. package/build/types/services/auth/oidc/providers/types.d.ts +144 -0
  39. package/build/types/services/auth/oidc/types.d.ts +40 -0
  40. package/build/types/services/auth/types.d.ts +39 -0
  41. package/build/types/services/auth/users/index.d.ts +5 -0
  42. package/build/types/services/auth/users/types.d.ts +121 -0
  43. package/build/types/services/configurations/general.d.ts +5 -0
  44. package/build/types/services/configurations/groups.d.ts +5 -0
  45. package/build/types/services/configurations/index.d.ts +10 -0
  46. package/build/types/services/configurations/patients.d.ts +5 -0
  47. package/build/types/services/configurations/staff.d.ts +5 -0
  48. package/build/types/services/configurations/types.d.ts +222 -0
  49. package/build/types/services/configurations/users.d.ts +5 -0
  50. package/build/types/services/data/comments.d.ts +5 -0
  51. package/build/types/services/data/documents.d.ts +5 -0
  52. package/build/types/services/data/index.d.ts +13 -0
  53. package/build/types/services/data/indexes.d.ts +5 -0
  54. package/build/types/services/data/infrastructure.d.ts +10 -0
  55. package/build/types/services/data/json-schema.d.ts +121 -0
  56. package/build/types/services/data/properties.d.ts +5 -0
  57. package/build/types/services/data/schemas.d.ts +5 -0
  58. package/build/types/services/data/statuses.d.ts +5 -0
  59. package/build/types/services/data/transitions.d.ts +5 -0
  60. package/build/types/services/data/types.d.ts +899 -0
  61. package/build/types/services/dispatchers/actions/index.d.ts +5 -0
  62. package/build/types/services/dispatchers/actions/types.d.ts +78 -0
  63. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -0
  64. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -0
  65. package/build/types/services/dispatchers/index.d.ts +7 -0
  66. package/build/types/services/dispatchers/types.d.ts +2 -0
  67. package/build/types/services/events/events.d.ts +5 -0
  68. package/build/types/services/events/health.d.ts +9 -0
  69. package/build/types/services/events/index.d.ts +6 -0
  70. package/build/types/services/events/subscriptions.d.ts +5 -0
  71. package/build/types/services/events/types.d.ts +90 -0
  72. package/build/types/services/files/files.d.ts +5 -0
  73. package/build/types/services/files/formHelpers.d.ts +3 -0
  74. package/build/types/services/files/index.d.ts +6 -0
  75. package/build/types/services/files/settings/index.d.ts +5 -0
  76. package/build/types/services/files/settings/types.d.ts +38 -0
  77. package/build/types/services/files/tokens.d.ts +5 -0
  78. package/build/types/services/files/types.d.ts +185 -0
  79. package/build/types/services/helpers.d.ts +7 -0
  80. package/build/types/services/http-client.d.ts +22 -0
  81. package/build/types/services/index.d.ts +15 -0
  82. package/build/types/services/localizations/countries.d.ts +5 -0
  83. package/build/types/services/localizations/health.d.ts +9 -0
  84. package/build/types/services/localizations/index.d.ts +4 -0
  85. package/build/types/services/localizations/languages.d.ts +5 -0
  86. package/build/types/services/localizations/localizations.d.ts +5 -0
  87. package/build/types/services/localizations/types.d.ts +145 -0
  88. package/build/types/services/logs/access/index.d.ts +5 -0
  89. package/build/types/services/logs/access/types.d.ts +41 -0
  90. package/build/types/services/logs/index.d.ts +3 -0
  91. package/build/types/services/logs/types.d.ts +4 -0
  92. package/build/types/services/mails/index.d.ts +3 -0
  93. package/build/types/services/mails/mails.d.ts +5 -0
  94. package/build/types/services/mails/types.d.ts +141 -0
  95. package/build/types/services/notifications/health.d.ts +9 -0
  96. package/build/types/services/notifications/index.d.ts +7 -0
  97. package/build/types/services/notifications/notifications.d.ts +5 -0
  98. package/build/types/services/notifications/settings.d.ts +5 -0
  99. package/build/types/services/notifications/types.d.ts +222 -0
  100. package/build/types/services/payments/appStore.d.ts +5 -0
  101. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/types/services/payments/health.d.ts +9 -0
  103. package/build/types/services/payments/index.d.ts +15 -0
  104. package/build/types/services/payments/orders.d.ts +5 -0
  105. package/build/types/services/payments/playStore.d.ts +5 -0
  106. package/build/types/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/types/services/payments/products.d.ts +5 -0
  109. package/build/types/services/payments/stripe.d.ts +5 -0
  110. package/build/types/services/payments/subscriptions.d.ts +5 -0
  111. package/build/types/services/payments/types.d.ts +1189 -0
  112. package/build/types/services/profiles/groups.d.ts +5 -0
  113. package/build/types/services/profiles/health.d.ts +9 -0
  114. package/build/types/services/profiles/index.d.ts +9 -0
  115. package/build/types/services/profiles/logs.d.ts +5 -0
  116. package/build/types/services/profiles/profiles.d.ts +5 -0
  117. package/build/types/services/profiles/types.d.ts +369 -0
  118. package/build/types/services/tasks/api/index.d.ts +5 -0
  119. package/build/types/services/tasks/api/types.d.ts +146 -0
  120. package/build/types/services/tasks/apiRequests/index.d.ts +5 -0
  121. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -0
  122. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -0
  123. package/build/types/services/tasks/apiRequests/types.d.ts +83 -0
  124. package/build/types/services/tasks/functions/index.d.ts +5 -0
  125. package/build/types/services/tasks/functions/types.d.ts +27 -0
  126. package/build/types/services/tasks/index.d.ts +15 -0
  127. package/build/types/services/tasks/logs/index.d.ts +5 -0
  128. package/build/types/services/tasks/logs/types.d.ts +28 -0
  129. package/build/types/services/tasks/schedules/index.d.ts +5 -0
  130. package/build/types/services/tasks/schedules/types.d.ts +88 -0
  131. package/build/types/services/tasks/tasks.d.ts +5 -0
  132. package/build/types/services/tasks/types.d.ts +107 -0
  133. package/build/types/services/templates/index.d.ts +3 -0
  134. package/build/types/services/templates/templates.d.ts +5 -0
  135. package/build/types/services/templates/types.d.ts +202 -0
  136. package/build/types/services/types.d.ts +77 -0
  137. package/build/types/services/users/activationRequests/index.d.ts +4 -0
  138. package/build/types/services/users/activationRequests/types.d.ts +70 -0
  139. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -0
  140. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -0
  141. package/build/types/services/users/globalRoles.d.ts +5 -0
  142. package/build/types/services/users/groupRoles.d.ts +5 -0
  143. package/build/types/services/users/health.d.ts +9 -0
  144. package/build/types/services/users/index.d.ts +16 -0
  145. package/build/types/services/users/settings/index.d.ts +4 -0
  146. package/build/types/services/users/settings/types.d.ts +47 -0
  147. package/build/types/services/users/types.d.ts +1055 -0
  148. package/build/types/services/users/users.d.ts +5 -0
  149. package/build/types/sha1.d.ts +11 -0
  150. package/build/types/types.d.ts +102 -0
  151. package/build/types/utils.d.ts +4 -0
  152. package/build/types/version.d.ts +1 -0
  153. package/package.json +57 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,1161 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [8.2.0]
9
+
10
+ ### Added
11
+ - `MfaRequiredError` now exposes a typed `mfa` property to complete the MFA flow type safe
12
+
13
+ ### Changed
14
+ - All runtime dependencies are now pinned to their specific version
15
+ - `axios` updated to `0.28.1`
16
+ - `fflate` updated to `0.8.2`
17
+ - `typescript-json-decoder` updated to `1.0.11`
18
+ - `qs` updated to `6.12.0`
19
+ - Removed the dependency on `ts-toolbelt` as it was no longer required
20
+
21
+ ### Fixed
22
+ - Using an oAuth2 confidential client on web no longer causes a `global not defined` error
23
+ - `exh.files.create` and `exh.files.createFromText` now work correctly while using oAuth1 in React Native
24
+ - The generic `API_ERROR` name is no longer shown for errors with more specific information available
25
+ - Type corrections for the user, profile, file, index and mfa entities
26
+ - Corrected the places where the name of a schema can also be used rather than just the id
27
+ - The `groupIds` for `exh.data.documents.unlinkGroups` is now correctly marked as optional
28
+ - Corrected the permission mentioned for `exh.users.groupRoles.removeUsersFromStaff`
29
+
30
+ ## [8.1.1]
31
+
32
+ ### Fixed
33
+ - Pinned the `qs` version because of breaking changes in their latest release for our oAuth1 signature generation
34
+
35
+ ## [8.1.0]
36
+
37
+ ### Changed
38
+
39
+ - `exh.users.createAccount` and `exh.users.updateEmail`:
40
+ - Now accept an `activationMode` field
41
+ - After enabling in the verification settings, this field can be set to use the pin code mode
42
+ - `exh.users.requestEmailActivation` and `exh.users.requestPasswordReset`:
43
+ - Alternatively now also accept an object with an `email` and `mode` field
44
+ - After enabling in the verification settings, the `mode` field can be set to use the pin code mode
45
+ - Additional errors are thrown when request limiting is enabled via the verification settings
46
+ - `exh.users.validatePasswordReset` and `exh.users.validateEmailActivation`:
47
+ - Alternatively now also accept an `email` and `pinCode` field
48
+ - Additional errors are thrown when using the pin code mode
49
+ - `exh.users.getEmailTemplates` and `exh.users.setEmailTemplates` now support the new pin code email templates:
50
+ - `oidcUnlinkPinEmailTemplateId`
51
+ - `activationPinEmailTemplateId`
52
+ - `reactivationPinEmailTemplateId`
53
+ - `passwordResetPinEmailTemplateId`
54
+ - Improved oAuth2 access token refreshing
55
+ - If the SDK is able to estimate the expiry time of an access token, the token is refreshed before it expires
56
+ - This done just before a request is about to made, preventing the extra request to just receive an expired token error
57
+ - Tokens received from the `exh.auth.authenticate` method, next to `expiresIn`, now also include an `creationTimestamp` field
58
+ - `createClient` and `createOAuth2Client` now accept an `expiresIn` and `creationTimestamp` field
59
+
60
+ ### Added
61
+
62
+ - Methods to work with the activation requests:
63
+ - `exh.users.activationRequests.find`
64
+ - `exh.users.activationRequests.findFirst`
65
+ - `exh.users.activationRequests.findById`
66
+ - `exh.users.activationRequests.findByUserId`
67
+ - `exh.users.activationRequests.remove`
68
+ - Methods to work with the forgot password requests:
69
+ - `exh.users.forgotPasswordRequests.find`
70
+ - `exh.users.forgotPasswordRequests.findFirst`
71
+ - `exh.users.forgotPasswordRequests.findById`
72
+ - `exh.users.forgotPasswordRequests.findByUserId`
73
+ - `exh.users.forgotPasswordRequests.remove`
74
+ - Methods to work with the user verification settings:
75
+ - `exh.users.settings.getVerificationSettings`
76
+ - `exh.users.settings.updateVerificationSettings`
77
+
78
+ ### Fixed
79
+
80
+ - `exh.auth.applications.deleteVersion` now calls the correct endpoint
81
+ - Automatic oAuth2 access token refreshing now properly uses client credentials
82
+ - Optional fields for `exh.auth.users.addMfaMethod` are now correctly marked as optional
83
+ - The return value of `exh.users.changePassword` is now correctly typed as a boolean
84
+ - Corrected the `VIEW_API_FUNCTION_REQUEST_LOGS` permission name mentioned in the inline documentation
85
+ - The `statuses` field of the data service `Schema` entity is now typed correctly
86
+
87
+ ## [8.0.0]
88
+
89
+ ### Changed
90
+ - **Breaking Change:** RQL values are now [double encoded](https://docs.extrahorizon.com/extrahorizon/additional-resources/resource-query-language-rql#double-encoding-of-special-characters) by default when using the RQL builder
91
+ - Disable double encoding for all RQL operations with `rqlBuilder.doubleEncodeValues = false`
92
+ - Disable double encoding for a single RQL operation `rqlBuilder({ doubleEncodeValues: false }).eq(name, '< value >').build()`
93
+ - Please consult the [Migration Guide](https://github.com/ExtraHorizon/javascript-sdk/blob/dev/MIGRATING_TO_V8.0.0.MD) for more information
94
+ - **Breaking Change:** Starting from v8.0.0, the SDK will no longer normalize custom keys in requests and responses. This means that all custom keys will be sent and received as they are provided.
95
+ - The normalization of custom keys can be re-enabled for a single operation to the behavior before 8.0.0 by setting the option `exh.service.operation({ normalizeCustomData: true })`
96
+ - The normalization of custom keys can be re-enabled for all operations on a client to the behavior before 8.0.0 using the snippet `exh = createClient({ ...options, normalizeCustomData: true });`
97
+ - Please consult the [Migration Guide](https://github.com/ExtraHorizon/javascript-sdk/blob/dev/MIGRATING_TO_V8.0.0.MD) for more information
98
+ - **Breaking Change:** For all unauthenticated methods the response will now undergo the same transformation steps as any other request.
99
+ - The timestamps previously returned as strings are now converted to date objects in `exh.auth.authenticate`, `exh.auth.confirmMfa` and`exh.users.createAccount`.
100
+ - Please consult the [Migration Guide](https://github.com/ExtraHorizon/javascript-sdk/blob/dev/MIGRATING_TO_V8.0.0.MD) for more information
101
+ - New implementation of the hashing for oAuth1 signature generation
102
+ - This change is not expected to have any impact on the SDK usage
103
+
104
+ ### Bug Fixes
105
+ - In the `TokenDataOauth1` interface `updateTimeStamp` is changed to `updateTimestamp`
106
+ - `timeZone` is now accepted as a valid parameter for the resolve functions in the template service
107
+
108
+
109
+ ## [v7.8.0]
110
+
111
+ ### Changed
112
+ - New implementation of the oAuth1 signature generation to support double Encoding of RQL values in `OAuth1` clients
113
+
114
+ ## [v7.7.0]
115
+
116
+ ### Added
117
+ - Functionality to allow the [double encoding](https://docs.extrahorizon.com/extrahorizon/additional-resources/resource-query-language-rql#double-encoding-of-special-characters) of values when using the RQL builder
118
+ - Enable double encoding for all RQL operations with `rqlBuilder.doubleEncodeValues = true`
119
+ - Enable double encoding for a single RQL operation `rqlBuilder({ doubleEncodeValues: true }).eq(name, '< value >').build()`
120
+ - When enabling double encoded values ensure that instances of encoding values for the rql builder such as `encodeURIComponent()` are removed
121
+ - Double Encoding of RQL values is currently only supported in `OAuth2` clients and will come to `OAuth1` clients at a later date.
122
+
123
+
124
+ - A skip count operator to the rql builder `rqlBuilder().eq(name, '< value >').skipCount().build()`
125
+ - Providing this operator skips the record counting step of a request to increase performance. As a result, the page object in a response will not include the total field.
126
+ - The skip count operator is currently supported in [select services](https://docs.extrahorizon.com/extrahorizon/additional-resources/resource-query-language-rql#services-with-the-skip-count-rql-operator), and efforts are underway to make it available for all services.
127
+
128
+ ### Fixed
129
+ - Documentation for an incorrect permission value of `exh.users.globalRoles.addPermissions()`
130
+ - `REMOVE_ROLE_PERMISSIONS` to `REMOVE_ROLE_PERMISSION`
131
+
132
+ ## [v7.6.0]
133
+
134
+ ### Added
135
+ - `findAll`, `findAllIterator` and `update` methods to the Dispatcher service
136
+
137
+ ### Improvements
138
+ - Updated types and documentation for the Dispatcher service
139
+ - Exported the missing `RQLString` type
140
+
141
+ ## [v7.5.1]
142
+
143
+ ### Added
144
+ - Type support React Native form data
145
+
146
+ ### Fixes
147
+ - Bumped Axios version to fix content-type header issue
148
+ - Fixed `onUploadProgress` callback event triggering without a provided function
149
+ - Removed discrimination between node and web environments
150
+
151
+ ## [v7.5.0]
152
+
153
+ ### Added
154
+
155
+ - Support for File Service settings:
156
+ - File Service [settings](https://docs.extrahorizon.com/extrahorizon/services/manage-data/file-service#settings) may now be managed using methods found in:
157
+ - `exh.files.settings`
158
+
159
+ ## [v7.4.1]
160
+
161
+ ### Fixes
162
+
163
+ - Correctly export the interfaces of the tasks component
164
+
165
+ ## [v7.4.0]
166
+
167
+ ### Added
168
+
169
+ - Support for API Functions:
170
+ - An [API Function](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/api-functions) may now be executed using methods found in:
171
+ - `exh.tasks.api`
172
+ - [API Requests](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/api-functions#api-requests) produced by executing API Functions are accessible using methods found in:
173
+ - `exh.tasks.apiRequests`
174
+ - [API Request Logs](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/api-functions#api-request-logs) produced during the execution of an API Function can be accessed using methods found in:
175
+ - `exh.tasks.apiRequests.logs`
176
+
177
+
178
+ - A Function may now be directly executed as a task using the method:
179
+ - `exh.tasks.functions.execute()`
180
+
181
+
182
+ - Support for Tasks
183
+ - Task Schedules may now be managed using methods found in:
184
+ - `exh.tasks.schedules`
185
+ - Task Logs produced during the execution of a task can now be accessed using methods found in:
186
+ - `exh.tasks.logs`
187
+
188
+
189
+ - Monitoring File Uploads
190
+ - The SDK now supports [monitoring file uploads](https://docs.extrahorizon.com/extrahorizon/services/manage-data/file-service#monitoring-a-file-upload) in the browser using a callback function.
191
+ ```js
192
+ function uploadProgressCallback(event) {
193
+ const progress = (event.loaded / event.total) * 100;
194
+ // ... Do something with the progress value
195
+ }
196
+
197
+ const fileMetaData = await exh.files.create('myReport.pdf', myBuffer, {
198
+ onUploadProgress: uploadProgressCallback,
199
+ tags: ['ecg-report']
200
+ });
201
+ ```
202
+
203
+ ### Changed
204
+
205
+ - `VIEW_GROUPS` permission value is changed to the correct `VIEW_GROUP`
206
+ - `ADD_ROLE_PERMISSION` is now described correctly as singular in the inline documentation
207
+ - Updated `RegisterUserData` interface optional fields
208
+
209
+ ## [v7.3.0]
210
+
211
+ ### Added
212
+
213
+ - Support for OpenID Connect
214
+ - OAuth 2 clients now allow users to authenticate themselves with OpenID connect. See:
215
+ - `exh.auth.generateOidcAuthenticationUrl()`
216
+ - `exh.auth.authenticateWithOidc()`
217
+ - Manage your OpenID Connect configuration via new methods found in:
218
+ - `exh.auth.oidc`
219
+ - `exh.auth.oidc.providers`
220
+ - `exh.auth.oidc.loginAttempts`
221
+ - Methods to manage the User Service email templates:
222
+ - `exh.users.getEmailTemplates()`
223
+ - `exh.users.setEmailTemplates()`
224
+ - While creating an oAuth1 client both `token` and `tokenSecret` can now be supplied.
225
+ In which case there is no need for an extra `exh.auth.authenticate` call.
226
+
227
+ ```ts
228
+ const exh = createClient({
229
+ host: 'https://api.example.extrahorizon.io',
230
+ consumerKey: 'cf29b211b5030202ffce5b2510759d0a53ea5b17',
231
+ consumerSecret: '9bd34e19b5e1714e2c57ae0127d98dd0d0c0b2a2',
232
+ token: '409ce9ba49c56cce31b9d2b1b2f5ed5ac01b4011',
233
+ tokenSecret: '1cc0b97b4c4721bb6da3d85b80cda8165e6ad5a7',
234
+ });
235
+
236
+ const currentUser = await exh.users.me();
237
+ ```
238
+
239
+ - While creating an oAuth2 client both `refreshToken` and `accessToken` can now be supplied.
240
+ In which case there is no need for an extra `exh.auth.authenticate` call.
241
+
242
+ ```ts
243
+ const exh = createClient({
244
+ host: 'https://api.example.extrahorizon.io',
245
+ clientId: 'f8d9c891c106131bec970c6da05f887dc82eaff7',
246
+ refreshToken: 'ca27ada704e5b26a1fca20c130daf4f95f727d3f',
247
+ accessToken: '019dc6fe1672176f28e8e894ba99aed1f49656c8',
248
+ });
249
+
250
+ const currentUser = await exh.users.me();
251
+ ```
252
+
253
+ ### Changed
254
+ - Improved types and inline documentation (JSDoc) for the `exh.auth.applications` section
255
+ - More detailed descriptions for the methods
256
+ - Descriptions for the fields within the data types we accept and return
257
+
258
+ ## [v7.2.1]
259
+
260
+ ### Added
261
+
262
+ - Support large file uploads
263
+
264
+ ### Fixes
265
+
266
+ - Task cancellation
267
+
268
+ ## [v7.2.0]
269
+
270
+ ### Added
271
+
272
+ - For API errors the `qName` variable is mapped to the `name` variable, to improve consistency with default errors.
273
+
274
+ ### Fixes
275
+
276
+ - Corrected the interfaces to be consistent with the API
277
+ - Updated dead links in documentation
278
+
279
+ ## [v7.1.0]
280
+
281
+ ### Added
282
+
283
+ - `logout()` can now be performed on a proxy Client
284
+ - Tasks now take an optional generic to set the data type
285
+ - `userId` is now available on the raw mock
286
+
287
+ ### Fixes
288
+
289
+ - The return type of `exh.users.update()` is returning the correct `UserData`. See [issue #605](https://github.com/ExtraHorizon/javascript-sdk/issues/605)
290
+
291
+ ## [v7.0.0]
292
+
293
+ ### Added
294
+
295
+ - OAuth1 token management -> `exh.auth.oauth1.getTokens` / `exh.auth.oauth1.removeToken`. See [issue #465](https://github.com/ExtraHorizon/javascript-sdk/issues/465)
296
+ - Password policy -> `exh.users.passwordPolicy` and `exh.users.updatePasswordPolicy`
297
+ - Extra Playstore endpoint -> `payments.playStoreHistory.purchaseReceipts`
298
+ - Extra permissions for the updated task service
299
+ - RQL option to several endpoints
300
+
301
+ ### Changed
302
+
303
+ - Types for the `exh.auth.application.create` and `exh.auth.application.createVersion` have been exported. See Authentication examples for more info.
304
+ - Pako to fflate
305
+ - Refactored the Schema and Document Types
306
+ - Updated the `EnlistmentConfiguration` type. See [issue #596](https://github.com/ExtraHorizon/javascript-sdk/issues/596)
307
+
308
+ ### Fixes
309
+ - Running `yarn` on windows machines resulted in an error [issue #612](https://github.com/ExtraHorizon/javascript-sdk/issues/612)
310
+ - Return type of `exh.auth.application.update` is now correctly typed as `AffectedRecords`
311
+
312
+ ### Breaking changes
313
+
314
+ - Removed `payments.playStoreHistory.purchases` (deprecated)
315
+ - The `contains` and `excludes` endpoints of the rql builder now accepts an array of expressions iso a single string. See [issue #603](https://github.com/ExtraHorizon/javascript-sdk/issues/603)
316
+ - The removal of the group roles now has the correct parameters
317
+
318
+ ```diff
319
+ - exh.users.groupRoles.remove(rql, groupId, roleId, options)
320
+ + exh.users.groupRoles.remove(rql, groupId, options)
321
+ ```
322
+
323
+ ## [v6.1.0]
324
+
325
+ ### Breaking changes
326
+
327
+ - renamed `createTransaction` to `completeTransaction` on the payments.appStore service
328
+
329
+ ```diff
330
+ - sdk.payments.appStore.createTransaction
331
+ + sdk.payments.appStore.completeTransaction
332
+ ```
333
+
334
+ ### Changed
335
+
336
+ - When passing in `localhost` as host. No prefixing takes places.
337
+ - Fixed bug when calling `sdk.files.create` with tags as an array. See [PR #544](https://github.com/ExtraHorizon/javascript-sdk/pull/544)
338
+ - Properties on your JSONSchema on the data service will no longer have any automatic date parsing. [PR #546](https://github.com/ExtraHorizon/javascript-sdk/pull/546)
339
+ - If you are using the `sdk.raw` instance you can now pass in additional parameters to the http verbs. See [PR #546](https://github.com/ExtraHorizon/javascript-sdk/pull/546)
340
+
341
+ ```ts
342
+ const result = sdk.raw.get('/files/v1', {
343
+ interceptors: {
344
+ skipCamelizeResponseData: true, // will recursively rename keys to camelCase
345
+ skipTransformResponseData: true, // maps the values of certain keys to Dates
346
+ skipTransformKeysResponseData: true, // renames certain keys for consistency
347
+ },
348
+ });
349
+ ```
350
+
351
+ - `Profile` type has been revised
352
+
353
+ ```diff
354
+ -fibricheckInfo?: string;
355
+ +fibricheckInfo?: {
356
+ + app?: {
357
+ + version?: string;
358
+ + build?: string;
359
+ + branch?: string;
360
+ + };
361
+ + device?: {
362
+ + os?: string;
363
+ + model?: string;
364
+ + type?: 'android' | 'ios';
365
+ + manufacturer?: string;
366
+ + };
367
+ +};
368
+ ```
369
+
370
+ - `ProxyClient` existed double. One of those has been renamed to `ProxyInstance`
371
+
372
+ ```diff
373
+ -export interface ProxyClient extends HttpInstance {
374
+ +export interface ProxyInstance extends HttpInstance {
375
+ ```
376
+
377
+ ## [v6.0.0]
378
+
379
+ ### Breaking Changes
380
+
381
+ - `sdk.data.documents.create` now accepts 3 generics.
382
+
383
+ ```diff
384
+ -create<CustomData = null, CustomStatus = null>(
385
+ - schemaId: ObjectId,
386
+ - requestBody: Record<string, any>,
387
+ - options?: OptionsWithRql & { gzip?: boolean }
388
+ -): Promise<Document<CustomData, CustomStatus>>;
389
+
390
+ +create<InputData = null, OutputData = null, CustomStatus = null>(
391
+ + schemaId: ObjectId,
392
+ + requestBody: InputData,
393
+ + options?: OptionsWithRql & { gzip?: boolean }
394
+ +): Promise<Document<OutputData, CustomStatus>>;
395
+ ```
396
+
397
+ ### Added
398
+
399
+ - `sdk.data.documents.update` now accepts a generic for the update type.
400
+ - Exported `findAllGeneric` and `findAllIterator` for usage on raw functions
401
+ - Better type for `findAllIterator`
402
+
403
+ ## [v5.3.1]
404
+
405
+ ### Added/Fixed
406
+
407
+ - Playstore endpoints can handle rql now
408
+
409
+ ## [v5.3.0]
410
+
411
+ ### Added
412
+
413
+ - There are now 3 mocked exports. `getMockSdkProxy`, `getMockSdkOAuth2` and `getMockSdkOAuth1` with matching types. The `getMockSdk` is also still available and mapped to `getMockSdkOAuth2`.
414
+
415
+ ## [v5.2.0]
416
+
417
+ ### Added
418
+
419
+ - `btoa` function to be used when you are using React-Native in combination with a Confidential Application. See documentation for more info.
420
+ - `createOAuth1Client` and `createOAuth2Client` have had their type signatures updated. The `freshTokensCallback` will now have the correct type.
421
+ - Updated payments service to reflect v1.2.0 payments REST API
422
+ - `createProxyClient` is a new way to initialize the SDK using a proxy service.
423
+
424
+ ### Changed
425
+
426
+ - `Comment` interface.
427
+
428
+ ```diff
429
+ - userId
430
+ + creatorId
431
+ + commentedTimestamp
432
+ ```
433
+
434
+ - `Document` interface now accepts an optional second parameter for the status property of the document. See [PR #461](https://github.com/ExtraHorizon/javascript-sdk/pull/461)
435
+ - Refactor of `userId` getter on the `sdk.raw` instance. It now works consistently everywhere (browser/node/react-native). See [PR #462](https://github.com/ExtraHorizon/javascript-sdk/pull/462)
436
+ - Added `findAll` and `findAllIterator` to notifications. The `find` method is also update to have pagination helpers [PR #475](https://github.com/ExtraHorizon/javascript-sdk/pull/475)
437
+
438
+ ## [v5.1.0]
439
+
440
+ ### Added
441
+
442
+ - `oauth1/ssoTokens/generate` and `oauth1/ssoTokens/consume` are added under the `sdk.auth.oauth1` scope. [More info](https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/SSO)
443
+
444
+ ### Changes
445
+
446
+ - Calls not needing authentication are now correctly skipping this
447
+
448
+ ```ts
449
+ sdk.users.createAccount();
450
+ sdk.users.requestPasswordReset();
451
+ sdk.users.requestEmailActivation();
452
+ sdk.users.isEmailAvailable();
453
+ ```
454
+
455
+ ## [v5.0.0]
456
+
457
+ ### Breaking Changes
458
+
459
+ - The payments services has had some refactoring.
460
+
461
+ ```diff
462
+ - sdk.payments.subscriptions.getEntitlements();
463
+ - sdk.payments.subscriptions.getEvents();
464
+ + sdk.payments.subscriptions.entitlements.find();
465
+ + sdk.payments.subscriptions.events.find();
466
+ ```
467
+
468
+ ```diff
469
+ - sdk.payments.appStoreSubscriptions.getSubscriptions();
470
+ - sdk.payments.appStoreSubscriptions.getSubscriptionsProducts();
471
+ + sdk.payments.appStoreSubscriptioons.subscriptions.find();
472
+ + sdk.payments.appStoreSubscriptioons.products.find();
473
+
474
+ - sdk.payments.appStoreSubscriptions.createSubscriptionsProduct();
475
+ - sdk.payments.appStoreSubscriptions.removeSubscriptionsProduct();
476
+ - sdk.payments.appStoreSubscriptions.updateSubscriptionsProduct();
477
+ + sdk.payments.appStoreSubscriptions.products.create();
478
+ + sdk.payments.appStoreSubscriptions.products.remove();
479
+ + sdk.payments.appStoreSubscriptions.products.update();
480
+ ```
481
+
482
+ ### Added
483
+
484
+ - `parseGlobalPermissions` is a function to parse strings are return valid permissions
485
+
486
+ ### Changed
487
+
488
+ - `userId` getter on the `OAuthClient` interface now returns a `Promise<string>` in stead of `string`. You can access this on `sdk.raw.userId`
489
+
490
+ ## [v4.5.0]
491
+
492
+ ### Added
493
+
494
+ - services that have a `findAll` method now also have `findAllIterator`.
495
+
496
+ ```ts
497
+ const iterator = sdk.data.documents.findAllIterator('5a9552adcfd7f200016728d5');
498
+
499
+ for await (const page of iterator) {
500
+ console.log(page); /* PagedResult<Document> */
501
+ }
502
+ ```
503
+
504
+ - `sdk.data.schemas`, `sdk.data.documents` and `sdk.data.users` have had changes to their `find` function. This now returns the current value with two added functions `next()` and `previous()` which can be used to easily traverse the data.
505
+
506
+ ```ts
507
+ const users = await sdk.users.find();
508
+
509
+ console.log('users,', users.page); // { total: 8268, offset: 0, limit: 20 }
510
+
511
+ console.log((await users.next()).page); // { total: 8268, offset: 20, limit: 20 }
512
+ console.log((await users.next()).page); // { total: 8268, offset: 40, limit: 20 }
513
+ console.log((await users.next()).page); // { total: 8268, offset: 60, limit: 20 }
514
+ console.log((await users.previous()).page); // { total: 8268, offset: 40, limit: 20 }
515
+ ```
516
+
517
+ - rqlParser accepts a regular string which will be checked using the parser function and returns a valid RQLString.
518
+
519
+ ### Changes
520
+
521
+ - added `endTimestamp` to list of fieldnames that are parsed at Date
522
+ - rqlBuilder now supports the `excludes` operator
523
+ - several examples had updates to reflect proper usage
524
+
525
+ ## [v4.4.0]
526
+
527
+ ### Changes
528
+
529
+ - Fixed `sdk.files.create` options types. See #352
530
+
531
+ ```diff
532
+ -options?: OptionsBase & { tags: [] }
533
+ +options?: OptionsBase & { tags: string[] }
534
+ ```
535
+
536
+ - JSDoc for `rqlBuilder().contains`. See #351
537
+
538
+ - GET requests returning a 500 status will be retried 4 more times at 300ms intervals. To disable this behaviour add `shouldRetry: false` to the options parameter. See #373
539
+
540
+ - `findAll` function added on users and data.documents. See #333
541
+
542
+ ## [v4.3.0]
543
+
544
+ ### Changes
545
+
546
+ - OAuth2 `authenticate` returns `tokenData`.
547
+ - OAuth2 `authenticate` can now be used with an authorization code. See Docs.
548
+ - OAuth2 supports confidentials applications.
549
+
550
+ ```ts
551
+ const sdk = createClient({
552
+ host: 'https://api.sandbox.extrahorizon.io',
553
+ clientId: '',
554
+ clientSecret: '',
555
+ });
556
+ ```
557
+
558
+ ## [v4.2.1]
559
+
560
+ ### Changes
561
+
562
+ - removed console.log in `sdk.data.documents.find` function
563
+
564
+ ## [v4.2.0]
565
+
566
+ ### Added
567
+
568
+ - Fixed documentation tables
569
+ - OAuth1 `authenticate` returns `tokenData`
570
+ - Updated documentation on SSL pinning
571
+ - Add `logout` function to `sdk.auth`
572
+ - Updated installation instructions
573
+ - Add `findAll` to `sdk.data.schemas`
574
+ - Client creation allows for extra headers which will be set on every call.
575
+
576
+ ```ts
577
+ const sdk = createClient({
578
+ host: 'https://api.sandbox.extrahorizon.io',
579
+ clientId: '',
580
+ headers: {
581
+ 'X-Forwarded-Application': 'test',
582
+ },
583
+ });
584
+ ```
585
+
586
+ - Functions now accept options to set custom headers
587
+
588
+ ```ts
589
+ await sdk.data.documents.create(
590
+ '5f3511c7e9ae42283ae2eb29',
591
+ {
592
+ model: 'string',
593
+ },
594
+ { gzip: true, headers: { 'x-test': 'test' } }
595
+ );
596
+ ```
597
+
598
+ ## [v4.1.0]
599
+
600
+ ### Added
601
+
602
+ - Added missing permissions
603
+ - Added findFirst method in users service
604
+
605
+ ### Changes
606
+
607
+ - Fixed bug to show a clear error when the user is not authenticated
608
+ - Fixed documentation format
609
+ - Updated README installation
610
+
611
+ ## [v4.0.0]
612
+
613
+ ### Breaking Changes
614
+
615
+ - Updated rql parameter type. Is always `rql: RQLString` now. Functions affected:
616
+ - sdk.payments.orders.addTagsToOrder
617
+ - sdk.payments.orders.removeTagsFromOrder
618
+ - sdk.payments.products.removeTagsFromProduct
619
+ - Updated parameter position if rql is a required parameter, it is always the first parameter. Functions affected
620
+ - sdk.users.groupRoles.remove
621
+ - sdk.users.groupRoles.removePermissions
622
+ - sdk.users.groupRoles.removeFromStaff
623
+ - sdk.users.groupRoles.removeUsersFromStaff
624
+ - Renamed all methods from `delete` to `remove` and all of them returning `AffectedRecords`
625
+ - Renamed all methods from `deleteFields` to `removeFields`
626
+
627
+ ## [3.2.0]
628
+
629
+ ### Added
630
+
631
+ - Localizations Service
632
+ - Profiles Service
633
+ - Notifications Service
634
+ - optional `skipTokenCheck` parameter to Oauth1 authentication flow with token/tokenSecret.
635
+ - Events Service
636
+
637
+ ### Changes
638
+
639
+ - Fixed return types of `sdk.users.getStaff` and `sdk.users.getPatients`
640
+ - Updated docs links
641
+ - `updateProfileImage` method is deprecated
642
+ - Gzip option `sdk.data.documents.create`
643
+
644
+ ```ts
645
+ await sdk.data.documents.create('schemaId', document, {
646
+ gzip: true,
647
+ });
648
+ ```
649
+
650
+ ## [3.1.0]
651
+
652
+ ### Breaking Changes
653
+
654
+ - `sdk.files.create` signature has changed.
655
+
656
+ ```diff
657
+ - sdk.files.create({name: 'test.pdf', file: file, extension: 'pdf', tags: ['tag']);
658
+ + sdk.files.create('test.pdf', file, {tags: ['tag]})
659
+ ```
660
+
661
+ - Custom Document no longer need to extend from DocumentBase. You can just pass in the type for `data`
662
+
663
+ ```diff
664
+ - interface CustomDocument extends DocumentBase {
665
+ - data: {
666
+ - ppg: Number[];
667
+ - location: {
668
+ - longitude: Number;
669
+ - latitude: Number;
670
+ - };
671
+ - };
672
+ - }
673
+ - const document = await sdk.data.documents.find<CustomDocument>();
674
+
675
+ + interface MyData {
676
+ + data: {
677
+ + ppg: Number[];
678
+ + location: {
679
+ + longitude: Number;
680
+ + latitude: Number;
681
+ + };
682
+ + };
683
+ + }
684
+ + const document = await sdk.data.documents.find<MyData>();
685
+ ```
686
+
687
+ ### Added
688
+
689
+ - `sdk.files.createFromText` where you can pass in your text directly.
690
+
691
+ ```ts
692
+ await sdk.files.createFromText('this-is-a-string');
693
+ ```
694
+
695
+ - Added `transitionsByName` getter to easily get the transition you need.
696
+
697
+ ```ts
698
+ const {
699
+ data: [schema],
700
+ } = await sdk.data.schemas.find();
701
+
702
+ const transition = schema.transitionsByName.lambda_to_review;
703
+ ```
704
+
705
+ - Added `findTransitionIdByName` function on `schema` objects to easily find the transitionId you need.
706
+
707
+ ```ts
708
+ const {
709
+ data: [schema],
710
+ } = await sdk.data.schemas.find();
711
+
712
+ const transitionId = schema.findTransitionIdByName('lambda_to_review');
713
+ ```
714
+
715
+ - Added `findById`, `findByName` and `findFirst` helpers to services having a generic `find` function.
716
+ - Payments Service
717
+ - Added `or`, `and` and `contains` operators to the RQL builder.
718
+
719
+ ## [3.0.2]
720
+
721
+ ### Breaking Changes
722
+
723
+ - `apiHost` has been renamed to `host` and should not include the protocol or `api` subdomain. Example `
724
+
725
+ ```diff
726
+ + const sdk = createClient({
727
+ + host: 'sandbox.extrahorizon.io',
728
+ + consumerKey: '',
729
+ + consumerSecret: '',
730
+ + });
731
+ ```
732
+
733
+ - `client` is renamed to `createClient`
734
+
735
+ ```diff
736
+ - import { client } from '@extrahorizon/javascript-sdk';
737
+ + import { createClient } from '@extrahorizon/javascript-sdk';
738
+ ```
739
+
740
+ - `rawAxios` is renamed to `raw`
741
+
742
+ ### Added
743
+
744
+ - `createOAuth1Client` and `createOAuth2Client` are now exported as more specifically typed versions of `createClient`
745
+ - Additional http header is added with every request. Which includes the package version and when running in node the node version.
746
+ - Added Test Reports
747
+ - `getMockSdk` function to get back a mocked SDK. See README for more info
748
+
749
+ ### Changes
750
+
751
+ - Templates `resolveAsPdf` will return a `Buffer`
752
+ - `sdk.authenticate` now includes possible error responses in the JSDoc annotations
753
+ - `rqlBuilder` now has JSDoc annotations
754
+ - Fix for results with arrays containing strings
755
+ - File creation now correctly set the file name on the form-data. Accepts extra parameter `extension` which defaults to `pdf`
756
+ - The MailsService now correctly decamelizes the keys in the request
757
+
758
+ ## [3.0.1]
759
+
760
+ ### Changes
761
+
762
+ - Templates basepath fix
763
+
764
+ ## [3.0.0]
765
+
766
+ ### Breaking Changes
767
+
768
+ - Services scoping:
769
+
770
+ ```diff
771
+ auth: {
772
+ - createApplication(),
773
+ - getApplications(),
774
+ - updateApplication(),
775
+ - deleteApplication(),
776
+ - createApplicationVersion(),
777
+ - deleteApplicationVersion(),
778
+ + applications: {
779
+ + create(),
780
+ + get(),
781
+ + update(),
782
+ + delete(),
783
+ + createVersion(),
784
+ + deleteVersion(),
785
+ + },
786
+ - createOauth2Authorization(),
787
+ - getOauth2Authorizations(),
788
+ - deleteOauth2Authorization(),
789
+ + oauth2: {
790
+ + createAuthorization(),
791
+ + getAuthorizations(),
792
+ + deleteAuthorization()
793
+ + },
794
+ - getMfaSetting(),
795
+ - enableMfa(),
796
+ - disableMfa(),
797
+ - addMfaSetting(),
798
+ - confirmMfaMethodVerification(),
799
+ - removeMfaMethod(),
800
+ + users: {
801
+ + getMfaSetting(),
802
+ + enableMfa(),
803
+ + disableMfa(),
804
+ + addMfaSetting(),
805
+ + confirmMfaMethodVerification(),
806
+ + removeMfaMethod()
807
+ + }
808
+ },
809
+ data: {
810
+ - createSchema(),
811
+ - updateSchema(),
812
+ - deleteSchema(),
813
+ - enableSchema(),
814
+ - disableSchema(),
815
+ + schemas: {
816
+ + create(),
817
+ + find(),
818
+ + update(),
819
+ + delete(),
820
+ + enable(),
821
+ + disable(),
822
+ + },
823
+ - createIndex(),
824
+ - deleteIndex(),
825
+ + indexes: {
826
+ + create(),
827
+ + delete(),
828
+ + },
829
+ - createStatus(),
830
+ - updateStatus(),
831
+ - deleteStatus(),
832
+ + statuses: {
833
+ + create(),
834
+ + update(),
835
+ + delete(),
836
+ + },
837
+ - createProperty(),
838
+ - deleteProperty(),
839
+ - updateProperty(),
840
+ + properties: {
841
+ + create(),
842
+ + update(),
843
+ + delete(),
844
+ + },
845
+ - createComment(),
846
+ - findComments(),
847
+ - updateComment(),
848
+ - deleteComment(),
849
+ + comments: {
850
+ + create(),
851
+ + find(),
852
+ + update(),
853
+ + delete(),
854
+ + },
855
+ - createDocument(),
856
+ - findDocuments(),
857
+ - updateDocument(),
858
+ - deleteDocument(),
859
+ - deleteFieldsFromDocument(),
860
+ - transitionDocument(),
861
+ - linkGroupsToDocument(),
862
+ - unlinkGroupsFromDocument(),
863
+ - linkUsersToDocument(),
864
+ - unlinkUsersFromDocument(),
865
+ + documents: {
866
+ + create(),
867
+ + find(),
868
+ + update(),
869
+ + delete(),
870
+ + deleteFields(),
871
+ + transition(),
872
+ + linkGroups(),
873
+ + unlinkGroups(),
874
+ + linkUsers(),
875
+ + unlinkUsers(),
876
+ + },
877
+ - updateCreationTransition(),
878
+ - createTransition(),
879
+ - updateTransition(),
880
+ - deleteTransition()
881
+ + transitions: {
882
+ + updateCreation(),
883
+ + create(),
884
+ + update(),
885
+ + delete(),
886
+ + }
887
+ },
888
+ files: {
889
+ - createFile(),
890
+ - deleteFile(),
891
+ - retrieveFile(),
892
+ - retrieveFileStream(),
893
+ - getFileDetails(),
894
+ + create(),
895
+ + delete(),
896
+ + retrieve(),
897
+ + retrieveStream(),
898
+ + getDetails(),
899
+ },
900
+ tasks: {
901
+ - createTask(),
902
+ - cancelTask(),
903
+ + create(),
904
+ + cancel(),
905
+ },
906
+ users: {
907
+ - getPermissions(),
908
+ - getRoles(),
909
+ - createRole(),
910
+ - deleteRole(),
911
+ - updateRole(),
912
+ - addPermissionsToRole(),
913
+ - removePermissionsFromRole(),
914
+ - addRolesToUsers(),
915
+ - removeRolesFromUsers(),
916
+ + globalRoles: {
917
+ + getPermissions(),
918
+ + get(),
919
+ + create(),
920
+ + delete(),
921
+ + update(),
922
+ + addPermissions(),
923
+ + removePermissions(),
924
+ + addToUsers(),
925
+ + removeFromUsers(),
926
+ + },
927
+ - getGroupsPermissions(),
928
+ - getGroupsRoles(),
929
+ - addRoleToGroup(),
930
+ - updateGroupsRole(),
931
+ - removeRoleFromGroup(),
932
+ - addPermissionsToGroupRoles(),
933
+ - removePermissionsFromGroupRoles(),
934
+ - assignRolesToStaff(),
935
+ - removeRolesFromStaff(),
936
+ - addUsersToStaff(),
937
+ - removeUsersFromStaff(),
938
+ + groupRoles: {
939
+ + getPermissions(),
940
+ + get(),
941
+ + addRole(),
942
+ + update(),
943
+ + removeRole(),
944
+ + addPermissions(),
945
+ + removePermissions(),
946
+ + assignToStaff(),
947
+ + removeFromStaff(),
948
+ + addUsersToStaff(),
949
+ + removeUsersFromStaff(),
950
+ + },
951
+ }
952
+ ```
953
+
954
+ ### Added
955
+
956
+ - Configurations Service
957
+ - Dispatchers Service
958
+ - Mails Service
959
+ - Templates Service
960
+
961
+ ### Changes
962
+
963
+ - Types are now exposed within modules, so the usage will be:
964
+
965
+ ```
966
+ import type { FilesServicesTypes: { CreateFile } } from "@extrahorizon/javascript-sdk";
967
+ const inputFile: CreateFile = {}
968
+ ```
969
+
970
+ - Error now not only extend from the `ApiError` class but also from their respective HTTP error code error. Possible errors are
971
+ - 400: `BadRequestError`
972
+ - 401: `UnauthorizedError`
973
+ - 403: `ForbiddenError`
974
+ - 404: `NotFoundError`
975
+ - 500: `ServerError`
976
+ - PagedResults are now using generics
977
+ - Every merge into dev will create a tag and package with the current version number suffixed with `-dev.X` where X auto-increments
978
+ - Removed `* @throws {ApiError}` in JSDoc comments, only specific errors are mentioned when mentioned in the Swagger documentation
979
+
980
+ ## [2.0.0] - 2021-05-12
981
+
982
+ ### Breaking changes
983
+
984
+ - ClientId for OAuth2 and consumerkey/secret for Oauth1 are now passed in during client initialization in stead of authentication. This way on not authenicated calls the clientId and consumerkey/secret information is added to the requests.
985
+
986
+ OAuth2
987
+
988
+ ```diff
989
+ const sdk = client({
990
+ apiHost: '',
991
+ + clientId: '',
992
+ });
993
+
994
+ await sdk.authenticate({
995
+ - clientId: '',
996
+ password: '',
997
+ username: ''
998
+ });
999
+ ```
1000
+
1001
+ OAuth1
1002
+
1003
+ ```diff
1004
+ const sdk = client({
1005
+ apiHost: '',
1006
+ + consumerKey: '',
1007
+ + consumerSecret: '',
1008
+ });
1009
+
1010
+ await sdk.authenticate({
1011
+ - consumerKey: '',
1012
+ - consumerSecret: '',
1013
+ password: '',
1014
+ email: ''
1015
+ });
1016
+ ```
1017
+
1018
+ ### Changes
1019
+
1020
+ - Removed `query` from list results
1021
+ - `PartialUserData` is renamed to `User`
1022
+ - Changes to the `UserData` interface
1023
+ - `language` type is changed from `string` to `LanguageCode`
1024
+ - `timeZone` type is changed from `string` to `TimeZone`
1025
+ - `lastFailedTimestamp` type is changed from `number` to `Date`
1026
+ - added `creationTimestamp` and `updateTimestamp`
1027
+ - Change to the `RegisterUserData` interface
1028
+ - `phoneNumber` is now required
1029
+
1030
+ ## [1.0.1] - 2021-05-05
1031
+
1032
+ ### Changes
1033
+
1034
+ - Correctly exporting all the possible errors.
1035
+
1036
+ ## [1.0.0] - 2021-05-05
1037
+
1038
+ ### Breaking changes
1039
+
1040
+ Optional paramaters are now grouped in an options object as last parameters.
1041
+
1042
+ ```diff
1043
+ - await sdk.tasks.find(rql);
1044
+ + await sdk.tasks.find({ rql });
1045
+ ```
1046
+
1047
+ ```diff
1048
+ - await sdk.users.getGroupsRoles(groupId, rql);
1049
+ + await sdk.tasks.getGroupsRoles(groupId, { rql });
1050
+ ```
1051
+
1052
+ ### Added
1053
+
1054
+ - The Axios instance used by the SDK is now directly accessible
1055
+ - Data Service now includes:
1056
+ - Transitions Service
1057
+ - Documents Service
1058
+ - Comments Service
1059
+ - You can pass in your own interface when calling the `sdk.data.findDocuments<CustomDocument>(schemaId);` endpoint
1060
+ - The SDK also expose JSON-schema interface you can use to compose your own
1061
+
1062
+ ### Changes
1063
+
1064
+ - OAuth1 token/tokenSecret flow is implemented.
1065
+ - Functions expecting an RQL should now show a more clear error when passing in a regular string.
1066
+
1067
+ ## [0.0.7] - 2021-04-28
1068
+
1069
+ ### Breaking changes
1070
+
1071
+ The `authenticate` and `confirmMfa` methods have been scoped under the `auth` namespace.
1072
+
1073
+ ```diff
1074
+ -await sdk.authenticate({ refreshToken: '' });
1075
+ +await sdk.auth.authenticate({ refreshToken: '' });
1076
+ ```
1077
+
1078
+ Certains methods under the `users` namespace have had their name changed.
1079
+
1080
+ ```diff
1081
+ -sdk.user.mfaDisable
1082
+ +sdk.user.disableMfa
1083
+ -sdk.user.mfaEnable
1084
+ +sdk.user.enableMfa
1085
+ -sdk.user.mfaSetting
1086
+ +sdk.user.getMfaSetting
1087
+ -sdk.user.mfaAddMethod
1088
+ +sdk.user.addMfaMethod
1089
+ -sdk.user.mfaMethodConfirmVerification
1090
+ +sdk.user.confirmMfaMethodVerification
1091
+ -sdk.user.mfaRemoveMethod
1092
+ +sdk.user.removeMfaMethod
1093
+ ```
1094
+
1095
+ Removed `debug` option. Use `responseLogger` and `requestLogger` options in stead. See README for example.
1096
+
1097
+ ```diff
1098
+ -const sdk = client({
1099
+ - apiHost: '',
1100
+ - debug: true
1101
+ -});
1102
+
1103
+
1104
+ +import AxiosLogger from "axios-logger";
1105
+ +
1106
+ +const sdk = client({
1107
+ + apiHost: '',
1108
+ + requestLogger: AxiosLogger.requestLogger,
1109
+ + responseLogger: AxiosLogger.responseLogger
1110
+ +});
1111
+ ```
1112
+
1113
+ ### Added
1114
+
1115
+ - Tasks Service
1116
+ - Data Service now includes:
1117
+ - Schemas Service
1118
+ - Properties Service
1119
+ - Statuses Service
1120
+ - Indexes Service
1121
+
1122
+ ## [0.0.6] - 2021-04-21
1123
+
1124
+ ### Breaking changes
1125
+
1126
+ Client initialization is changed. For example if you want to use the OAuth2 password flow, you no longer pass in the credentials as `oauth` property in the client. But you have to call the `authenticate` function. See README for other flows.
1127
+
1128
+ ```diff
1129
+ -const sdk = client({
1130
+ - apiHost: '',
1131
+ - oauth: {
1132
+ - clientId: '',
1133
+ - password: '',
1134
+ - username: '',
1135
+ - },
1136
+ -});
1137
+
1138
+ +const sdk = client({
1139
+ + apiHost: '',
1140
+ +});
1141
+ +
1142
+ +await sdk.authenticate({
1143
+ + clientId: '',
1144
+ + password: '',
1145
+ + username: ''
1146
+ +});
1147
+ ```
1148
+
1149
+ ### Added
1150
+
1151
+ - Multi-factor authentication via (authenticate / confirmMfa functions).
1152
+ - `freshTokensCallback` option when creating the client. Pass in a function to retrieve the response when new tokens are received.
1153
+ - OAuth2 Refresh Token Grant flow.
1154
+ - `files` service.
1155
+ - `data` service: only to create a schema at the moment.
1156
+
1157
+ ### Changes
1158
+
1159
+ - Functions that accept an RQL parameter no longer accepts regular string, but expect the output of and rqlBuilder -> build().
1160
+ - `ApiError` now extends the built-in `Error`.
1161
+ - Some functions allowed empty `requestBody` which was incorrect in some cases, these have been fixed as well.