@extrahorizon/javascript-sdk 8.2.0 → 8.2.1-dev-49-61b4511

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