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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/build/btoa.d.ts +6 -0
  3. package/build/client.d.ts +147 -0
  4. package/build/constants.d.ts +17 -0
  5. package/build/errorHandler.d.ts +1 -0
  6. package/build/errors.d.ts +361 -0
  7. package/build/http/client.d.ts +2 -0
  8. package/build/http/index.d.ts +4 -0
  9. package/build/http/interceptors.d.ts +9 -0
  10. package/build/http/oAuth1Signature.d.ts +18 -0
  11. package/build/http/oauth1.d.ts +3 -0
  12. package/build/http/oauth2.d.ts +3 -0
  13. package/build/http/proxy.d.ts +3 -0
  14. package/build/http/types.d.ts +331 -0
  15. package/build/http/utils.d.ts +21 -0
  16. package/build/index.cjs.js +1 -1
  17. package/build/index.d.ts +9 -0
  18. package/build/index.mjs +1 -1
  19. package/build/mock.d.ts +43 -0
  20. package/build/mockType.d.ts +1721 -0
  21. package/build/parseStoredCredentials.d.ts +11 -0
  22. package/build/rql/index.d.ts +16 -0
  23. package/build/rql/parser.d.ts +1 -0
  24. package/build/rql/types.d.ts +174 -0
  25. package/build/services/auth/applications/index.d.ts +5 -0
  26. package/build/services/auth/applications/types.d.ts +260 -0
  27. package/build/services/auth/index.d.ts +3 -0
  28. package/build/services/auth/oauth1/index.d.ts +5 -0
  29. package/build/services/auth/oauth1/types.d.ts +102 -0
  30. package/build/services/auth/oauth2/index.d.ts +5 -0
  31. package/build/services/auth/oauth2/types.d.ts +100 -0
  32. package/build/services/auth/oidc/index.d.ts +5 -0
  33. package/build/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  34. package/build/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  35. package/build/services/auth/oidc/providers/index.d.ts +5 -0
  36. package/build/services/auth/oidc/providers/types.d.ts +148 -0
  37. package/build/services/auth/oidc/types.d.ts +40 -0
  38. package/build/services/auth/types.d.ts +39 -0
  39. package/build/services/auth/users/index.d.ts +5 -0
  40. package/build/services/auth/users/types.d.ts +121 -0
  41. package/build/services/configurations/general.d.ts +5 -0
  42. package/build/services/configurations/groups.d.ts +5 -0
  43. package/build/services/configurations/index.d.ts +10 -0
  44. package/build/services/configurations/patients.d.ts +5 -0
  45. package/build/services/configurations/staff.d.ts +5 -0
  46. package/build/services/configurations/types.d.ts +222 -0
  47. package/build/services/configurations/users.d.ts +5 -0
  48. package/build/services/data/comments.d.ts +5 -0
  49. package/build/services/data/documents.d.ts +5 -0
  50. package/build/services/data/index.d.ts +13 -0
  51. package/build/services/data/indexes.d.ts +5 -0
  52. package/build/services/data/infrastructure.d.ts +10 -0
  53. package/build/services/data/json-schema.d.ts +121 -0
  54. package/build/services/data/properties.d.ts +5 -0
  55. package/build/services/data/schemas.d.ts +5 -0
  56. package/build/services/data/statuses.d.ts +5 -0
  57. package/build/services/data/transitions.d.ts +5 -0
  58. package/build/services/data/types.d.ts +1500 -0
  59. package/build/services/dispatchers/actions/index.d.ts +5 -0
  60. package/build/services/dispatchers/actions/types.d.ts +78 -0
  61. package/build/services/dispatchers/dispatchers/index.d.ts +5 -0
  62. package/build/services/dispatchers/dispatchers/types.d.ts +111 -0
  63. package/build/services/dispatchers/index.d.ts +7 -0
  64. package/build/services/dispatchers/types.d.ts +2 -0
  65. package/build/services/events/events.d.ts +5 -0
  66. package/build/services/events/index.d.ts +5 -0
  67. package/build/services/events/subscriptions.d.ts +5 -0
  68. package/build/services/events/types.d.ts +107 -0
  69. package/build/services/files/files.d.ts +5 -0
  70. package/build/services/files/formHelpers.d.ts +3 -0
  71. package/build/services/files/index.d.ts +6 -0
  72. package/build/services/files/settings/index.d.ts +5 -0
  73. package/build/services/files/settings/types.d.ts +38 -0
  74. package/build/services/files/tokens.d.ts +5 -0
  75. package/build/services/files/types.d.ts +185 -0
  76. package/build/services/helpers.d.ts +7 -0
  77. package/build/services/http-client.d.ts +22 -0
  78. package/build/services/index.d.ts +16 -0
  79. package/build/services/localizations/countries.d.ts +5 -0
  80. package/build/services/localizations/index.d.ts +3 -0
  81. package/build/services/localizations/languages.d.ts +5 -0
  82. package/build/services/localizations/localizations.d.ts +5 -0
  83. package/build/services/localizations/types.d.ts +150 -0
  84. package/build/services/logs/access/index.d.ts +5 -0
  85. package/build/services/logs/access/types.d.ts +41 -0
  86. package/build/services/logs/index.d.ts +3 -0
  87. package/build/services/logs/types.d.ts +4 -0
  88. package/build/services/mails/index.d.ts +3 -0
  89. package/build/services/mails/mails.d.ts +5 -0
  90. package/build/services/mails/types.d.ts +149 -0
  91. package/build/services/notifications/index.d.ts +6 -0
  92. package/build/services/notifications/notifications.d.ts +5 -0
  93. package/build/services/notifications/settings.d.ts +5 -0
  94. package/build/services/notifications/types.d.ts +235 -0
  95. package/build/services/notificationsV2/index.d.ts +6 -0
  96. package/build/services/notificationsV2/notificationsV2.d.ts +5 -0
  97. package/build/services/notificationsV2/types.d.ts +166 -0
  98. package/build/services/notificationsV2/userSettings/index.d.ts +5 -0
  99. package/build/services/notificationsV2/userSettings/types.d.ts +138 -0
  100. package/build/services/payments/appStore.d.ts +5 -0
  101. package/build/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/services/payments/health.d.ts +9 -0
  103. package/build/services/payments/index.d.ts +15 -0
  104. package/build/services/payments/orders.d.ts +5 -0
  105. package/build/services/payments/playStore.d.ts +5 -0
  106. package/build/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/services/payments/products.d.ts +5 -0
  109. package/build/services/payments/stripe.d.ts +5 -0
  110. package/build/services/payments/subscriptions.d.ts +5 -0
  111. package/build/services/payments/types.d.ts +1198 -0
  112. package/build/services/profiles/groups.d.ts +5 -0
  113. package/build/services/profiles/index.d.ts +8 -0
  114. package/build/services/profiles/logs.d.ts +5 -0
  115. package/build/services/profiles/profiles.d.ts +5 -0
  116. package/build/services/profiles/types.d.ts +375 -0
  117. package/build/services/tasks/api/index.d.ts +5 -0
  118. package/build/services/tasks/api/types.d.ts +146 -0
  119. package/build/services/tasks/apiRequests/index.d.ts +5 -0
  120. package/build/services/tasks/apiRequests/logs/index.d.ts +5 -0
  121. package/build/services/tasks/apiRequests/logs/types.d.ts +25 -0
  122. package/build/services/tasks/apiRequests/types.d.ts +83 -0
  123. package/build/services/tasks/functions/index.d.ts +5 -0
  124. package/build/services/tasks/functions/types.d.ts +171 -0
  125. package/build/services/tasks/index.d.ts +15 -0
  126. package/build/services/tasks/logs/index.d.ts +5 -0
  127. package/build/services/tasks/logs/types.d.ts +28 -0
  128. package/build/services/tasks/schedules/index.d.ts +5 -0
  129. package/build/services/tasks/schedules/types.d.ts +92 -0
  130. package/build/services/tasks/tasks.d.ts +5 -0
  131. package/build/services/tasks/types.d.ts +118 -0
  132. package/build/services/templates/index.d.ts +3 -0
  133. package/build/services/templates/templates.d.ts +5 -0
  134. package/build/services/templates/types.d.ts +237 -0
  135. package/build/services/templatesV2/index.d.ts +3 -0
  136. package/build/services/templatesV2/templatesV2.d.ts +5 -0
  137. package/build/services/templatesV2/types.d.ts +156 -0
  138. package/build/services/types.d.ts +103 -0
  139. package/build/services/users/activationRequests/index.d.ts +4 -0
  140. package/build/services/users/activationRequests/types.d.ts +70 -0
  141. package/build/services/users/forgotPasswordRequests/index.d.ts +4 -0
  142. package/build/services/users/forgotPasswordRequests/types.d.ts +70 -0
  143. package/build/services/users/globalRoles.d.ts +5 -0
  144. package/build/services/users/groupRoles.d.ts +5 -0
  145. package/build/services/users/index.d.ts +14 -0
  146. package/build/services/users/settings/index.d.ts +4 -0
  147. package/build/services/users/settings/types.d.ts +47 -0
  148. package/build/services/users/types.d.ts +1278 -0
  149. package/build/services/users/users.d.ts +5 -0
  150. package/build/sha1.d.ts +11 -0
  151. package/build/types/services/users/types.d.ts +69 -25
  152. package/build/types/version.d.ts +1 -1
  153. package/build/types.d.ts +104 -0
  154. package/build/utils.d.ts +5 -0
  155. package/build/version.d.ts +1 -0
  156. package/package.json +3 -3
@@ -0,0 +1,1500 @@
1
+ import { FindAllIterator } from '../../services/helpers';
2
+ import type { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult, PagedResultWithPager } from '../types';
3
+ import type { JSONSchema7 } from './json-schema';
4
+ export declare enum JSONSchemaType {
5
+ OBJECT = "object",
6
+ ARRAY = "array",
7
+ STRING = "string",
8
+ NUMBER = "number",
9
+ BOOLEAN = "boolean"
10
+ }
11
+ export declare type JSONSchema = JSONSchemaObject | JSONSchemaArray | JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean;
12
+ export declare type JSONSchemaObject = Pick<JSONSchema7, 'required'> & {
13
+ type: JSONSchemaType.OBJECT;
14
+ properties?: {
15
+ [key: string]: JSONSchema;
16
+ };
17
+ additionalProperties?: JSONSchema;
18
+ };
19
+ export declare type JSONSchemaArray = Pick<JSONSchema7, 'minItems' | 'maxItems'> & {
20
+ type: JSONSchemaType.ARRAY;
21
+ items: JSONSchema | JSONSchema[];
22
+ contains: JSONSchema;
23
+ };
24
+ export declare type JSONSchemaString = Pick<JSONSchema7, 'minLength' | 'maxLength' | 'pattern' | 'enum'> & {
25
+ type: JSONSchemaType.STRING;
26
+ const: string;
27
+ format: 'date-time';
28
+ };
29
+ export declare type JSONSchemaNumber = Pick<JSONSchema7, 'type' | 'minimum' | 'maximum' | 'enum'> & {
30
+ type: JSONSchemaType.NUMBER;
31
+ const: number;
32
+ };
33
+ export declare type JSONSchemaBoolean = {
34
+ type: JSONSchemaType.BOOLEAN;
35
+ enum: boolean[];
36
+ const: boolean;
37
+ };
38
+ export declare type RelationalAccessMode = 'creator' | 'linkedUsers' | 'linkedGroupStaff' | 'linkedGroupPatients';
39
+ /**
40
+ * Specifies the conditions to be met in order to be able to create a document for a schema
41
+ */
42
+ export declare type CreateMode = 'permissionRequired' | 'allUsers'
43
+ /** @deprecated use 'allUsers' instead */
44
+ | 'default';
45
+ /**
46
+ * Specifies the conditions to be met in order to be able to view a document for a schema
47
+ */
48
+ export declare type ReadMode = 'permissionRequired' | 'allUsers' | Array<RelationalAccessMode>
49
+ /** @deprecated use ['linkedUsers', 'linkedGroupStaff'] instead */
50
+ | 'default'
51
+ /** @deprecated use ['linkedGroupPatients', 'linkedGroupStaff'] instead */
52
+ | 'enlistedInLinkedGroups';
53
+ /**
54
+ * Specifies the conditions to be met in order to be able to update a document for a schema
55
+ */
56
+ export declare type UpdateMode = 'permissionRequired' | Array<RelationalAccessMode>
57
+ /** @deprecated use ['linkedUsers', 'linkedGroupStaff'] instead */
58
+ | 'default'
59
+ /** @deprecated use ['creator'] instead */
60
+ | 'creatorOnly'
61
+ /** @deprecated use 'permissionRequired' instead */
62
+ | 'disabled'
63
+ /** @deprecated use ['linkedGroupStaff'] instead */
64
+ | 'linkedGroupsStaffOnly';
65
+ /**
66
+ * Specifies the conditions to be met in order to be able to delete a document for a schema
67
+ */
68
+ export declare type DeleteMode = 'permissionRequired' | Array<RelationalAccessMode>
69
+ /** @deprecated use ['linkedUsers','linkedGroupStaff'] instead */
70
+ | 'linkedUsersOnly';
71
+ export declare type GroupSyncMode = 'disabled' | 'creatorPatientEnlistments' | 'linkedUsersPatientEnlistments';
72
+ interface BaseConfiguration {
73
+ queryable?: boolean;
74
+ }
75
+ export interface ArrayConfiguration extends BaseConfiguration {
76
+ type?: 'array';
77
+ items?: TypeConfiguration;
78
+ minItems?: number;
79
+ maxItems?: number;
80
+ contains?: TypeConfiguration;
81
+ }
82
+ export interface ObjectConfiguration extends BaseConfiguration {
83
+ type?: 'object';
84
+ properties?: Record<string, TypeConfiguration>;
85
+ additionalProperties?: TypeConfiguration;
86
+ required?: string[];
87
+ }
88
+ export interface StringConfiguration extends BaseConfiguration {
89
+ type?: 'string';
90
+ minLength?: number;
91
+ maxLength?: number;
92
+ enum?: string[];
93
+ pattern?: string;
94
+ format?: 'date-time';
95
+ const?: string;
96
+ }
97
+ export interface NumberConfiguration extends BaseConfiguration {
98
+ type?: 'number';
99
+ minimum?: number;
100
+ maximum?: number;
101
+ enum?: number[];
102
+ const?: string;
103
+ }
104
+ export interface BooleanConfiguration extends BaseConfiguration {
105
+ type?: 'boolean';
106
+ enum?: boolean[];
107
+ const?: boolean;
108
+ }
109
+ export declare type TypeConfiguration = ObjectConfiguration | ArrayConfiguration | StringConfiguration | NumberConfiguration | BooleanConfiguration;
110
+ export interface DocumentCondition {
111
+ type?: 'document';
112
+ configuration?: TypeConfiguration;
113
+ }
114
+ export interface InputCondition {
115
+ type?: 'input';
116
+ configuration?: TypeConfiguration;
117
+ }
118
+ export interface InitiatorHasRelationToUserInDataCondition {
119
+ type?: 'initiatorHasRelationToUserInData';
120
+ userIdField?: ObjectId;
121
+ relation?: 'isStaffOfTargetPatient';
122
+ }
123
+ export declare type InitiatorHasRelationToGroupInDataConditionRelation = 'staff' | 'patient';
124
+ export interface InitiatorHasRelationToGroupInDataCondition {
125
+ type?: 'initiatorHasRelationToGroupInData';
126
+ groupIdField?: ObjectId;
127
+ relation?: InitiatorHasRelationToGroupInDataConditionRelation;
128
+ requiredPermission?: string;
129
+ }
130
+ export declare type Condition = InputCondition | DocumentCondition | InitiatorHasRelationToUserInDataCondition | InitiatorHasRelationToGroupInDataCondition;
131
+ export declare type CreationTransitionType = 'manual' | 'automatic';
132
+ export interface TransitionActionSet {
133
+ type: 'set';
134
+ field: string;
135
+ value: unknown;
136
+ }
137
+ export interface TransitionActionUnset {
138
+ type: 'unset';
139
+ field: string[];
140
+ }
141
+ export interface TransitionActionAddItems {
142
+ type: 'addItems';
143
+ field: string;
144
+ values: string[];
145
+ }
146
+ export interface TransitionActionRemoveItems {
147
+ type: 'removeItems';
148
+ field: string;
149
+ values: string[];
150
+ }
151
+ export interface TransitionActionTask {
152
+ type: 'task';
153
+ functionName: string;
154
+ priority?: number;
155
+ data: Record<string, unknown>;
156
+ }
157
+ export interface TransitionActionLinkCreator {
158
+ type: 'linkCreator';
159
+ }
160
+ export interface TransitionActionLinkEnlistedGroups {
161
+ type: 'linkEnlistedGroups';
162
+ onlyActive: boolean;
163
+ }
164
+ export interface TransitionActionLinkUserFromData {
165
+ type: 'linkUserFromData';
166
+ userIdField: string;
167
+ }
168
+ export interface TransitionActionLinkGroupFromData {
169
+ type: 'linkGroupFromData';
170
+ groupIdField: string;
171
+ }
172
+ export interface TransitionActionDelay {
173
+ type: 'delay';
174
+ time: number;
175
+ }
176
+ /**
177
+ * @deprecated Legacy action, should not be used in new projects
178
+ */
179
+ export interface TransitionActionMeasurementReviewedNotification {
180
+ type: 'measurementReviewedNotification';
181
+ }
182
+ /**
183
+ * @deprecated Legacy action, the AlgoQueueManager does not exist anymore
184
+ */
185
+ export interface TransitionActionNotifyAlgoQueueManager {
186
+ type: 'notifyAlgoQueueManager';
187
+ }
188
+ export declare type TransitionAction = TransitionActionSet | TransitionActionUnset | TransitionActionAddItems | TransitionActionRemoveItems | TransitionActionTask | TransitionActionLinkCreator | TransitionActionLinkEnlistedGroups | TransitionActionLinkUserFromData | TransitionActionLinkGroupFromData | TransitionActionDelay | TransitionActionMeasurementReviewedNotification;
189
+ export declare type TransitionAfterAction = TransitionActionNotifyAlgoQueueManager | TransitionActionTask;
190
+ export interface CreationTransition {
191
+ toStatus: string;
192
+ type: CreationTransitionType;
193
+ conditions?: Condition[];
194
+ actions?: TransitionAction[];
195
+ afterActions?: TransitionAfterAction[];
196
+ }
197
+ export declare type StatusData = Record<string, string>;
198
+ export declare type TransitionInput = CreationTransition & {
199
+ name?: string;
200
+ fromStatuses: string[];
201
+ };
202
+ export declare type Transition = TransitionInput & {
203
+ id: ObjectId;
204
+ };
205
+ export interface Schema {
206
+ id: ObjectId;
207
+ name: string;
208
+ description: string;
209
+ properties: Record<string, TypeConfiguration>;
210
+ indexes: Index[];
211
+ statuses: Record<string, Record<string, string>>;
212
+ creationTransition: CreationTransition;
213
+ transitions: Transition[];
214
+ createMode: CreateMode;
215
+ readMode: ReadMode;
216
+ updateMode: UpdateMode;
217
+ deleteMode: DeleteMode;
218
+ groupSyncMode: GroupSyncMode;
219
+ defaultLimit?: number;
220
+ maximumLimit?: number;
221
+ updateTimestamp: Date;
222
+ creationTimestamp: Date;
223
+ findTransitionIdByName?: (name: string) => ObjectId | undefined;
224
+ transitionsByName?: Record<string, Transition>;
225
+ }
226
+ export interface SchemaInput {
227
+ name: string;
228
+ description: string;
229
+ createMode?: CreateMode;
230
+ readMode?: ReadMode;
231
+ updateMode?: UpdateMode;
232
+ deleteMode?: DeleteMode;
233
+ groupSyncMode?: GroupSyncMode;
234
+ defaultLimit?: number;
235
+ maximumLimit?: number;
236
+ }
237
+ export declare type UpdateSchemaInput = Partial<SchemaInput>;
238
+ export declare type IndexFieldsName = string;
239
+ export declare type IndexFieldsType = 'asc' | 'desc' | 'text';
240
+ export interface IndexOptions {
241
+ unique?: boolean;
242
+ sparse?: boolean;
243
+ }
244
+ export interface Index {
245
+ id: ObjectId;
246
+ name: string;
247
+ fields: {
248
+ name: IndexFieldsName;
249
+ type: IndexFieldsType;
250
+ }[];
251
+ options?: IndexOptions;
252
+ system?: boolean;
253
+ }
254
+ export declare type IndexInput = Pick<Index, 'fields' | 'options'>;
255
+ export declare type TransitionDocumentInput = {
256
+ id: ObjectId;
257
+ name?: string;
258
+ data?: Record<string, unknown>;
259
+ } | {
260
+ id?: ObjectId;
261
+ name: string;
262
+ data?: Record<string, unknown>;
263
+ };
264
+ export interface Document<CustomData = null, CustomStatus = null> {
265
+ id: ObjectId;
266
+ userIds: ObjectId[];
267
+ groupIds: ObjectId[];
268
+ status: CustomStatus extends null ? string : CustomStatus;
269
+ data: CustomData extends null ? Record<string, unknown> : CustomData;
270
+ transitionLock?: {
271
+ timestamp?: Date;
272
+ };
273
+ commentCount?: number;
274
+ updateTimestamp: Date;
275
+ creationTimestamp: Date;
276
+ statusChangedTimestamp: Date;
277
+ creatorId: ObjectId;
278
+ }
279
+ export declare type CommentText = string;
280
+ export interface Comment {
281
+ id: ObjectId;
282
+ schemaId: ObjectId;
283
+ documentId: ObjectId;
284
+ creatorId: ObjectId;
285
+ text: CommentText;
286
+ commentedTimestamp?: Date;
287
+ updateTimestamp: Date;
288
+ creationTimestamp: Date;
289
+ }
290
+ export interface DataCommentsService {
291
+ /**
292
+ * Create a comment
293
+ *
294
+ * Comment on the specified document.
295
+ *
296
+ * Permission | Scope | Effect
297
+ * - | - | -
298
+ * none | | Comment on your own documents
299
+ * `CREATE_DOCUMENT_COMMENTS` | `staff enlistment` | Comment on any document belonging to the group
300
+ * `CREATE_DOCUMENT_COMMENTS` | `global` | Comment on any document
301
+ * @param schemaIdOrName The id or name of the targeted schema.
302
+ * @param documentId The id of the targeted document.
303
+ * @param requestBody
304
+ * @returns {Promise<Comment>}
305
+ * @throws {LockedDocumentError}
306
+ */
307
+ create(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
308
+ text: CommentText;
309
+ }, options?: OptionsBase): Promise<Comment>;
310
+ /**
311
+ * Request a list of comments
312
+ *
313
+ * List the comments for the specified document.
314
+ *
315
+ * Permission | Scope | Effect
316
+ * - | - | -
317
+ * none | | View comments for your own documents
318
+ * `VIEW_DOCUMENT_COMMENTS` | `staff enlistment` | View comments for any document belonging to the group
319
+ * `VIEW_DOCUMENT_COMMENTS` | `global` | View the comments for any document
320
+ * @param schemaIdOrName The id or name of the targeted schema.
321
+ * @param documentId The id of the targeted document.
322
+ * @returns {Promise<PagedResult<Comment>>}
323
+ */
324
+ find(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<Comment>>;
325
+ /**
326
+ * Find By Id
327
+ * @param id the Id to search for
328
+ * @param schemaIdOrName The id or name of the targeted schema.
329
+ * @param documentId The id of the targeted document.
330
+ * @returns the first element found
331
+ */
332
+ findById(id: ObjectId, schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment | undefined>;
333
+ /**
334
+ * Find First
335
+ * @param schemaIdOrName The id or name of the targeted schema.
336
+ * @param documentId The id of the targeted document.
337
+ * @returns the first element found
338
+ */
339
+ findFirst(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment | undefined>;
340
+ /**
341
+ * Update a comment
342
+ *
343
+ * Update a comment you made.
344
+ *
345
+ * Permission | Scope | Effect
346
+ * - | - | -
347
+ * none | | Update your comments
348
+ * `UPDATE_DOCUMENT_COMMENTS` | `global` | Update comments
349
+ * @param commentId The id of the targeted comment.
350
+ * @param schemaIdOrName The id or name of the targeted schema.
351
+ * @param documentId The id of the targeted document.
352
+ * @returns {Promise<AffectedRecords>}
353
+ */
354
+ update(commentId: ObjectId, schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
355
+ text: CommentText;
356
+ }, options?: OptionsBase): Promise<AffectedRecords>;
357
+ /**
358
+ * Delete a comment
359
+ *
360
+ * Delete a comments from the specified measurement.
361
+ *
362
+ * Permission | Scope | Effect
363
+ * - | - | -
364
+ * none | | Delete your comments
365
+ * `UPDATE_DOCUMENT_COMMENTS` | `staff enlistment` | Delete comments for any document belonging to the group
366
+ * `UPDATE_DOCUMENT_COMMENTS` | `global` | Delete the comments for any document
367
+ * @param commentId The id of the targeted comment.
368
+ * @param schemaIdOrName The id or name of the targeted schema.
369
+ * @param documentId The id of the targeted document.
370
+ * @returns {Promise<AffectedRecords>}
371
+ */
372
+ remove(commentId: ObjectId, schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
373
+ }
374
+ export interface DataDocumentsService {
375
+ /**
376
+ * Check if the document is not in a locked state
377
+ *
378
+ * Actions cannot be performed if the document has a transitionLock
379
+ *
380
+ * @param schemaIdOrName The id or name of the targeted schema.
381
+ * @param documentId The id of the targeted document.
382
+ * @returns boolean success
383
+ * @throws {Error} If the document is in a locked state after the specified tries
384
+ */
385
+ assertNonLockedState(schemaIdOrName: ObjectId | string, documentId: ObjectId, tries: number, retryTimeInMs: number, options?: OptionsBase): Promise<boolean>;
386
+ /**
387
+ * # Create a document
388
+ *
389
+ * ## Access via permissions
390
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
391
+ * Permission | Scopes | Effect
392
+ * - | - | -
393
+ * `CREATE_DOCUMENTS` | `global` | Create a document for any schema
394
+ * `CREATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Create a document for the specified schema
395
+ * <br>
396
+ *
397
+ * ## General access mode values
398
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
399
+ * General createMode value | Description
400
+ * - | -
401
+ * `"permissionRequired"` | The permissions above apply
402
+ * `"allUsers"` | All users can create a document
403
+ * <br>
404
+ *
405
+ * ## Legacy access mode values
406
+ * Listed below are the deprecated values with their current equivalent
407
+ * Legacy createMode value | Description
408
+ * - | -
409
+ * `"default"` | Translates to the `"allUsers"` general access mode value
410
+ *
411
+ * # Interface
412
+ * @param schemaIdOrName The id or name of the targeted schema.
413
+ * @param requestBody
414
+ * @returns {Document} document
415
+ * @throws {IllegalArgumentError}
416
+ */
417
+ create<InputData = Record<string, any>, OutputData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, requestBody: InputData, options?: OptionsWithRql & {
418
+ gzip?: boolean;
419
+ }): Promise<Document<OutputData, CustomStatus>>;
420
+ /**
421
+ * # Request a list of documents
422
+ *
423
+ * ## Access via permissions
424
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
425
+ * Permission | Scopes | Effect
426
+ * - | - | -
427
+ * `VIEW_DOCUMENTS` | `global` | View any document
428
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
429
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
430
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
431
+ * <br>
432
+ *
433
+ * ## General access mode values
434
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
435
+ * General readMode value | Description
436
+ * - | -
437
+ * `"permissionRequired"` | The permissions above apply
438
+ * `"allUsers"` | All users can view any document of the specified schema
439
+ * <br>
440
+ *
441
+ * ## Relational access mode values
442
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
443
+ * Relational readMode value | Description
444
+ * - | -
445
+ * `["creator"]` | The user that created the document can view the document.
446
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
447
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
448
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
449
+ * <br>
450
+ *
451
+ * ## Legacy access mode values
452
+ * Listed below are the deprecated values with their current equivalent
453
+ * Legacy updateMode value | Description
454
+ * - | -
455
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
456
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
457
+ *
458
+ * # Interface
459
+ * @param schemaIdOrName The id or name of the targeted schema.
460
+ * @returns PagedResultWithPager<Document>
461
+ */
462
+ find<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<PagedResultWithPager<Document<CustomData, CustomStatus>>>;
463
+ /**
464
+ * # Request a list of all documents
465
+ *
466
+ * Do not pass in an rql with limit operator!
467
+ *
468
+ * ## Access via permissions
469
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
470
+ * Permission | Scopes | Effect
471
+ * - | - | -
472
+ * `VIEW_DOCUMENTS` | `global` | View any document
473
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
474
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
475
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
476
+ * <br>
477
+ *
478
+ * ## General access mode values
479
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
480
+ * General readMode value | Description
481
+ * - | -
482
+ * `"permissionRequired"` | The permissions above apply
483
+ * `"allUsers"` | All users can view any document of the specified schema
484
+ * <br>
485
+ *
486
+ * ## Relational access mode values
487
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
488
+ * Relational readMode value | Description
489
+ * - | -
490
+ * `["creator"]` | The user that created the document can view the document.
491
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
492
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
493
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
494
+ * <br>
495
+ *
496
+ * ## Legacy access mode values
497
+ * Listed below are the deprecated values with their current equivalent
498
+ * Legacy updateMode value | Description
499
+ * - | -
500
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
501
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
502
+ *
503
+ * # Interface
504
+ * @param schemaIdOrName The id or name of the targeted schema.
505
+ * @returns Document[]
506
+ */
507
+ findAll<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus>[]>;
508
+ /**
509
+ * # Request a list of all documents and return a generator
510
+ *
511
+ * ## Access via permissions
512
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
513
+ * Permission | Scopes | Effect
514
+ * - | - | -
515
+ * `VIEW_DOCUMENTS` | `global` | View any document
516
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
517
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
518
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
519
+ * <br>
520
+ *
521
+ * ## General access mode values
522
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
523
+ * General readMode value | Description
524
+ * - | -
525
+ * `"permissionRequired"` | The permissions above apply
526
+ * `"allUsers"` | All users can view any document of the specified schema
527
+ * <br>
528
+ *
529
+ * ## Relational access mode values
530
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
531
+ * Relational readMode value | Description
532
+ * - | -
533
+ * `["creator"]` | The user that created the document can view the document.
534
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
535
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
536
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
537
+ * <br>
538
+ *
539
+ * ## Legacy access mode values
540
+ * Listed below are the deprecated values with their current equivalent
541
+ * Legacy updateMode value | Description
542
+ * - | -
543
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
544
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
545
+ *
546
+ * # Interface
547
+ * @param schemaIdOrName The id or name of the targeted schema.
548
+ * @returns Document[]
549
+ */
550
+ findAllIterator<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): FindAllIterator<Document<CustomData, CustomStatus>>;
551
+ /**
552
+ * # Find a document by id
553
+ *
554
+ * ## Access via permissions
555
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
556
+ * Permission | Scopes | Effect
557
+ * - | - | -
558
+ * `VIEW_DOCUMENTS` | `global` | View any document
559
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
560
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
561
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
562
+ * <br>
563
+
564
+ * ## General access mode values
565
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
566
+ * General readMode value | Description
567
+ * - | -
568
+ * `"permissionRequired"` | The permissions above apply
569
+ * `"allUsers"` | All users can view any document of the specified schema
570
+ * <br>
571
+
572
+ * ## Relational access mode values
573
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
574
+ * Relational readMode value | Description
575
+ * - | -
576
+ * `["creator"]` | The user that created the document can view the document.
577
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
578
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
579
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
580
+ * <br>
581
+ *
582
+ * ## Legacy access mode values
583
+ * Listed below are the deprecated values with their current equivalent
584
+ * Legacy updateMode value | Description
585
+ * - | -
586
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
587
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
588
+ *
589
+ * # Interface
590
+ * @param schemaIdOrName The id or name of the targeted schema.
591
+ * @param documentId the Id to search for
592
+ * @returns {Document} document
593
+ */
594
+ findById<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
595
+ /**
596
+ * # Find the first document that matches the applied filter
597
+ *
598
+ * ## Access via permissions
599
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
600
+ * Permission | Scopes | Effect
601
+ * - | - | -
602
+ * `VIEW_DOCUMENTS` | `global` | View any document
603
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
604
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
605
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
606
+ * <br>
607
+ *
608
+ * ## General access mode values
609
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
610
+ * General readMode value | Description
611
+ * - | -
612
+ * `"permissionRequired"` | The permissions above apply
613
+ * `"allUsers"` | All users can view any document of the specified schema
614
+ * <br>
615
+ *
616
+ * ## Relational access mode values
617
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
618
+ * Relational readMode value | Description
619
+ * - | -
620
+ * `["creator"]` | The user that created the document can view the document.
621
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
622
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
623
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
624
+ * <br>
625
+ *
626
+ * ## Legacy access mode values
627
+ * Listed below are the deprecated values with their current equivalent
628
+ * Legacy updateMode value | Description
629
+ * - | -
630
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
631
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
632
+ *
633
+ * # Interface
634
+ * @param schemaIdOrName The id or name of the targeted schema.
635
+ * @returns {Document} document
636
+ */
637
+ findFirst<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
638
+ /**
639
+ * # Update a document
640
+ *
641
+ * **Partially** update the selected document, provide `null` as a value to clear a field.
642
+ * <br>
643
+ * <br>
644
+ *
645
+ * ## Access via permissions
646
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
647
+ * Permission | Scopes | Effect
648
+ * - | - | -
649
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
650
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
651
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
652
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
653
+ * <br>
654
+ *
655
+ * ## General access mode values
656
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
657
+ * General updateMode value | Description
658
+ * - | -
659
+ * `"permissionRequired"` | The permissions above apply
660
+ * <br>
661
+ *
662
+ * ## Relational access mode values
663
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
664
+ * Relational updateMode value | Description
665
+ * - | -
666
+ * `["creator"]` | The user that created the document can update the document.
667
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
668
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
669
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
670
+ * <br>
671
+ *
672
+ * ## Legacy access mode values
673
+ * Listed below are the deprecated values with their current equivalent
674
+ * Legacy updateMode value | Description
675
+ * - | -
676
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
677
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
678
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
679
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
680
+ *
681
+ * # Interface
682
+ * @param schemaIdOrName The id or name of the targeted schema.
683
+ * @param documentId The id of the targeted document.
684
+ * @param requestBody Record<string, any>
685
+ * @returns AffectedRecords
686
+ */
687
+ update<UpdateData = Record<string, any>>(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: UpdateData, options?: OptionsWithRql): Promise<AffectedRecords>;
688
+ /**
689
+ * # Delete a document
690
+ *
691
+ * ## Access via permissions
692
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
693
+ * Permission | Scopes | Effect
694
+ * - | - | -
695
+ * `DELETE_DOCUMENTS` | `global` | Delete any document
696
+ * `DELETE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Delete any document of the specified schema
697
+ * `DELETE_DOCUMENTS` | `staff_enlistment` | Delete any document belonging to the group
698
+ * `DELETE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Delete any document of the specified schema belonging to the group
699
+ * <br>
700
+ *
701
+ * ## General access mode values
702
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
703
+ * General deleteMode value | Description
704
+ * - | -
705
+ * `"permissionRequired"` | The permissions above apply
706
+ * <br>
707
+ *
708
+ * ## Relational access mode values
709
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
710
+ * Relational deleteMode value | Description
711
+ * - | -
712
+ * `["creator"]` | The user that created the document can delete the document.
713
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can delete the document.
714
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can delete the document.
715
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can delete the document.
716
+ * <br>
717
+ *
718
+ * ## Legacy access mode values
719
+ * Listed below are the deprecated values with their current equivalent
720
+ * Legacy deleteMode value | Description
721
+ * - | -
722
+ * `"linkedUsersOnly"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
723
+ *
724
+ * # Interface
725
+ * @param schemaIdOrName The id or name of the targeted schema.
726
+ * @param documentId The id of the targeted document.
727
+ * @returns AffectedRecords
728
+ */
729
+ remove(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
730
+ /**
731
+ * # Delete the specified fields from the selected document.
732
+ *
733
+ * ## Access via permissions
734
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
735
+ * Permission | Scopes | Effect
736
+ * - | - | -
737
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
738
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
739
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
740
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
741
+ * <br>
742
+ *
743
+ * ## General access mode values
744
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
745
+ * General updateMode value | Description
746
+ * - | -
747
+ * `"permissionRequired"` | The permissions above apply
748
+ * <br>
749
+ *
750
+ * ## Relational access mode values
751
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
752
+ * Relational updateMode value | Description
753
+ * - | -
754
+ * `["creator"]` | The user that created the document can update the document.
755
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
756
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
757
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
758
+ * <br>
759
+ *
760
+ * ## Legacy access mode values
761
+ * Listed below are the deprecated values with their current equivalent
762
+ * Legacy updateMode value | Description
763
+ * - | -
764
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
765
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
766
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
767
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
768
+ *
769
+ * # Interface
770
+ * @param schemaIdOrName The id or name of the targeted schema.
771
+ * @param documentId The id of the targeted document.
772
+ * @param requestBody list of fields
773
+ * @returns AffectedRecords
774
+ */
775
+ removeFields(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
776
+ fields: Array<string>;
777
+ }, options?: OptionsWithRql): Promise<AffectedRecords>;
778
+ /**
779
+ * # Append an object to an array
780
+ *
781
+ * Append an object to an array field in the selected document.
782
+ *
783
+ * When the object is appended to the array, the object will automatically be assigned a unique `id`.
784
+ *
785
+ * ## Example
786
+ *
787
+ * For a schema with the name `daily-summary`, a document looking like:
788
+ *
789
+ * ```json
790
+ * {
791
+ * "id": "5f7b1b3b1f7b4b0001f7b4b2",
792
+ * "data": {
793
+ * "userId": "67e66ef64f0ea8488aba8f2f",
794
+ * "date": "2025-03-28",
795
+ * "hourlySummaries": [
796
+ * { "id": "6568d05351c0f5307421e196", "avg": 5, "max": 10, "min": 2 },
797
+ * { "id": "67e66793ae59de5bba4b262f", "avg": 7, "max": 15, "min": 3 }
798
+ * ]
799
+ * }
800
+ * }
801
+ * ```
802
+ *
803
+ * Appending an item to the `hourlySummaries`, looking like:
804
+ *
805
+ * ```json
806
+ * {
807
+ * "avg": 10,
808
+ * "max": 20,
809
+ * "min": 5
810
+ * }
811
+ * ```
812
+ *
813
+ * Would be done like:
814
+ *
815
+ * ```ts
816
+ * const documentId = '5f7b1b3b1f7b4b0001f7b4b2';
817
+ * const hourlySummary = { avg: 10, max: 20, min: 5 };
818
+ * await exh.data.documents.appendObjectToArray('daily-summary', documentId, 'hourlySummaries', hourlySummary);
819
+ * ```
820
+ *
821
+ * ## Access via permissions
822
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
823
+ * Permission | Scopes | Effect
824
+ * - | - | -
825
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
826
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
827
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
828
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
829
+ * <br>
830
+ *
831
+ * ## General access mode values
832
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
833
+ * General updateMode value | Description
834
+ * - | -
835
+ * `"permissionRequired"` | The permissions above apply
836
+ * <br>
837
+ *
838
+ * ## Relational access mode values
839
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
840
+ * Relational updateMode value | Description
841
+ * - | -
842
+ * `["creator"]` | The user that created the document can update the document.
843
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
844
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
845
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
846
+ * <br>
847
+ *
848
+ * ## Legacy access mode values
849
+ * Listed below are the deprecated values with their current equivalent
850
+ * Legacy updateMode value | Description
851
+ * - | -
852
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
853
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
854
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
855
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
856
+ */
857
+ appendObjectToArray<UpdateData = Record<string, any>>(schemaIdOrName: ObjectId | string, documentId: ObjectId, arrayField: string, requestBody: UpdateData, options?: OptionsBase): Promise<UpdateData & {
858
+ id: ObjectId;
859
+ }>;
860
+ /**
861
+ * # Update an object in an array
862
+ *
863
+ * Update an object in an array field in the selected document.
864
+ *
865
+ * ## Example
866
+ *
867
+ * For a schema with the name `daily-summary`, a document looking like:
868
+ *
869
+ * ```json
870
+ * {
871
+ * "id": "5f7b1b3b1f7b4b0001f7b4b2",
872
+ * "data": {
873
+ * "userId": "67e66ef64f0ea8488aba8f2f",
874
+ * "date": "2025-03-28",
875
+ * "hourlySummaries": [
876
+ * { "id": "6568d05351c0f5307421e196", "avg": 5, "max": 10, "min": 2 },
877
+ * { "id": "67e66793ae59de5bba4b262f", "avg": 7, "max": 15, "min": 3 }
878
+ * ]
879
+ * }
880
+ * }
881
+ * ```
882
+ *
883
+ * Updating the object with the id `67e66793ae59de5bba4b262f` in the `hourlySummaries` array would be done like:
884
+ *
885
+ * ```ts
886
+ * const documentId = '5f7b1b3b1f7b4b0001f7b4b2';
887
+ * const objectId = '67e66793ae59de5bba4b262f';
888
+ * const updateData = { avg: 8, max: 16, min: 4 };
889
+ * await exh.data.documents.updateObjectInArray('daily-summary', documentId, 'hourlySummaries', objectId, updateData);
890
+ * ```
891
+ *
892
+ * ## Access via permissions
893
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
894
+ * Permission | Scopes | Effect
895
+ * - | - | -
896
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
897
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
898
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
899
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
900
+ * <br>
901
+ *
902
+ * ## General access mode values
903
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
904
+ * General updateMode value | Description
905
+ * - | -
906
+ * `"permissionRequired"` | The permissions above apply
907
+ * <br>
908
+ *
909
+ * ## Relational access mode values
910
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
911
+ * Relational updateMode value | Description
912
+ * - | -
913
+ * `["creator"]` | The user that created the document can update the document.
914
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
915
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
916
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
917
+ * <br>
918
+ *
919
+ * ## Legacy access mode values
920
+ * Listed below are the deprecated values with their current equivalent
921
+ * Legacy updateMode value | Description
922
+ * - | -
923
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
924
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
925
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
926
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
927
+ */
928
+ updateObjectInArray<UpdateData = Record<string, any>>(schemaIdOrName: ObjectId | string, documentId: ObjectId, arrayField: string, objectId: ObjectId, requestBody: UpdateData, options?: OptionsBase): Promise<AffectedRecords>;
929
+ /**
930
+ * # Remove an object from an array
931
+ *
932
+ * Remove an object from an array field in the selected document.
933
+ *
934
+ * ## Example
935
+ *
936
+ * For a schema with the name `daily-summary`, a document looking like:
937
+ *
938
+ * ```json
939
+ * {
940
+ * "id": "5f7b1b3b1f7b4b0001f7b4b2",
941
+ * "data": {
942
+ * "userId": "67e66ef64f0ea8488aba8f2f",
943
+ * "date": "2025-03-28",
944
+ * "hourlySummaries": [
945
+ * { "id": "6568d05351c0f5307421e196", "avg": 5, "max": 10, "min": 2 },
946
+ * { "id": "67e66793ae59de5bba4b262f", "avg": 7, "max": 15, "min": 3 }
947
+ * ]
948
+ * }
949
+ * }
950
+ * ```
951
+ *
952
+ * Removing the object with the id `67e66793ae59de5bba4b262f` from the `hourlySummaries` array would be done like:
953
+ *
954
+ * ```ts
955
+ * const documentId = '5f7b1b3b1f7b4b0001f7b4b2';
956
+ * const objectId = '67e66793ae59de5bba4b262f';
957
+ * await exh.data.documents.removeObjectFromArray('daily-summary', documentId, 'hourlySummaries', objectId);
958
+ * ```
959
+ *
960
+ * ## Access via permissions
961
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
962
+ * Permission | Scopes | Effect
963
+ * - | - | -
964
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
965
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
966
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
967
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
968
+ * <br>
969
+ *
970
+ * ## General access mode values
971
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
972
+ * General updateMode value | Description
973
+ * - | -
974
+ * `"permissionRequired"` | The permissions above apply
975
+ * <br>
976
+ *
977
+ * ## Relational access mode values
978
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
979
+ * Relational updateMode value | Description
980
+ * - | -
981
+ * `["creator"]` | The user that created the document can update the document.
982
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
983
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
984
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
985
+ * <br>
986
+ *
987
+ * ## Legacy access mode values
988
+ * Listed below are the deprecated values with their current equivalent
989
+ * Legacy updateMode value | Description
990
+ * - | -
991
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
992
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
993
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
994
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
995
+ */
996
+ removeObjectFromArray(schemaIdOrName: ObjectId | string, documentId: ObjectId, arrayField: string, objectId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
997
+ /**
998
+ * # Transition a document
999
+ *
1000
+ * Start a transition manually for the selected document where the conditions of a manual transition are met.
1001
+ *
1002
+ * Note: the `id` or `name` in the requestBody are the `id` or `name` of the transition.
1003
+ *
1004
+ * ## Access via permissions
1005
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
1006
+ * Permission | Scopes | Effect
1007
+ * - | - | -
1008
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
1009
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
1010
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
1011
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
1012
+ * `TRANSITION_DOCUMENTS` | `global` | Transition any document
1013
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `global` | Transition any document of the specified schema
1014
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}:{TRANSITION_NAME}` | `global` | Transition any document of the specified schema with the specified transition name
1015
+ * `TRANSITION_DOCUMENTS` | `staff_enlistment` | Transition any document belonging to the group
1016
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Transition any document of the specified schema belonging to the group
1017
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}:{TRANSITION_NAME}` | `staff_enlistment` | Transition any document of the specified schema belonging to the group with the specified transition name
1018
+ * <br>
1019
+ *
1020
+ * ## General access mode values
1021
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
1022
+ * General updateMode value | Description
1023
+ * - | -
1024
+ * `"permissionRequired"` | The permissions above apply
1025
+ * <br>
1026
+ *
1027
+ * ## Relational access mode values
1028
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
1029
+ * Relational updateMode value | Description
1030
+ * - | -
1031
+ * `["creator"]` | The user that created the document can update the document.
1032
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
1033
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
1034
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
1035
+ * <br>
1036
+ *
1037
+ * ## Legacy access mode values
1038
+ * Listed below are the deprecated values with their current equivalent
1039
+ * Legacy updateMode value | Description
1040
+ * - | -
1041
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
1042
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
1043
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
1044
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
1045
+ *
1046
+ * # Interface
1047
+ * @param schemaIdOrName The id or name of the targeted schema.
1048
+ * @param documentId The id of the targeted document.
1049
+ * @param requestBody
1050
+ * @returns AffectedRecords
1051
+ * @throws {IllegalArgumentError}
1052
+ * @throws {ResourceUnknownError}
1053
+ */
1054
+ transition(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: TransitionDocumentInput, options?: OptionsWithRql): Promise<AffectedRecords>;
1055
+ /**
1056
+ * # Link groups to a document
1057
+ *
1058
+ * Link the specified groups to a document.
1059
+ *
1060
+ * Permission | Scope | Effect
1061
+ * - | - | -
1062
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Link groups to all documents
1063
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Link groups to the documents of the specified schema
1064
+ *
1065
+ * # Interface
1066
+ * @param schemaIdOrName The id or name of the targeted schema.
1067
+ * @param documentId The id of the targeted document.
1068
+ * @param requestBody list of groupIds
1069
+ * @returns AffectedRecords
1070
+ */
1071
+ linkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
1072
+ groupIds: Array<ObjectId>;
1073
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1074
+ /**
1075
+ * @deprecated Use `unlinkGroups(schemaIdOrName, documentId, groupIds)` or `unlinkAllGroups(schemaIdOrName, documentId)` instead.
1076
+ *
1077
+ * # Unlink groups from a document
1078
+ *
1079
+ * Unlink the specified groups from a document
1080
+ *
1081
+ * Specifying an **empty** `groupIds` array will have **no effect** on the document.
1082
+ *
1083
+ * **Not** specifying the `groupIds` array will **unlink all** groups from the document.
1084
+ *
1085
+ * Permission | Scope | Effect
1086
+ * - | - | -
1087
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
1088
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
1089
+ *
1090
+ * # Interface
1091
+ * @param schemaIdOrName The id or name of the targeted schema.
1092
+ * @param documentId The id of the targeted document.
1093
+ * @param requestBody list of groupIds
1094
+ * @returns AffectedRecords
1095
+ */
1096
+ unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
1097
+ groupIds?: Array<ObjectId>;
1098
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1099
+ /**
1100
+ * # Unlink groups from a document
1101
+ *
1102
+ * Unlink the specified groups from a document
1103
+ *
1104
+ * Specifying an **empty** `groupIds` array will have **no effect** on the document.
1105
+ *
1106
+ * Permission | Scope | Effect
1107
+ * - | - | -
1108
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
1109
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
1110
+ *
1111
+ * # Interface
1112
+ * @param schemaIdOrName The id or name of the targeted schema.
1113
+ * @param documentId The id of the targeted document.
1114
+ * @param groupIds list of groupIds
1115
+ * @returns AffectedRecords
1116
+ */
1117
+ unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, groupIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
1118
+ /**
1119
+ * # Unlink all groups from a document
1120
+ *
1121
+ * Permission | Scope | Effect
1122
+ * - | - | -
1123
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
1124
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
1125
+ *
1126
+ * # Interface
1127
+ * @param schemaIdOrName The id or name of the targeted schema.
1128
+ * @param documentId The id of the targeted document.
1129
+ * @returns AffectedRecords
1130
+ */
1131
+ unlinkAllGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
1132
+ /**
1133
+ * # Link users to a document
1134
+ *
1135
+ * Link the specified users to a document.
1136
+ *
1137
+ * Permission | Scope | Effect
1138
+ * - | - | -
1139
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Link users to all documents
1140
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Link users to all documents of the specified schema
1141
+ *
1142
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be added to the document.
1143
+ *
1144
+ * # Interface
1145
+ * @param schemaIdOrName The id or name of the targeted schema.
1146
+ * @param documentId The id of the targeted document.
1147
+ * @param requestBody list of userIds
1148
+ * @returns AffectedRecords
1149
+ */
1150
+ linkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
1151
+ userIds: Array<ObjectId>;
1152
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1153
+ /**
1154
+ * @deprecated Use `unlinkUsers(schemaIdOrName, documentId, userIds)` or `unlinkAllUsers(schemaIdOrName, documentId)` instead.
1155
+ *
1156
+ * # Unlink users from a document
1157
+ *
1158
+ * Unlink the specified users from a document.
1159
+ *
1160
+ * Specifying an **empty** `userIds` array will have **no effect** on the document.
1161
+ *
1162
+ * **Not** specifying the `userIds` array will **unlink all** users from the document.
1163
+ *
1164
+ * Permission | Scope | Effect
1165
+ * - | - | -
1166
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
1167
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
1168
+ *
1169
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be removed from the document.
1170
+ *
1171
+ * # Interface
1172
+ * @param schemaIdOrName The id or name of the targeted schema.
1173
+ * @param documentId The id of the targeted document.
1174
+ * @param requestBody list of userIds
1175
+ * @returns AffectedRecords
1176
+ */
1177
+ unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
1178
+ userIds?: Array<ObjectId>;
1179
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1180
+ /**
1181
+ * # Unlink users from a document
1182
+ *
1183
+ * Unlink the specified users from a document.
1184
+ *
1185
+ * Specifying an **empty** `userIds` array will have **no effect** on the document.
1186
+ *
1187
+ * Permission | Scope | Effect
1188
+ * - | - | -
1189
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
1190
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
1191
+ *
1192
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be removed from the document.
1193
+ *
1194
+ * # Interface
1195
+ * @param schemaIdOrName The id or name of the targeted schema.
1196
+ * @param documentId The id of the targeted document.
1197
+ * @param userIds list of userIds
1198
+ * @param requestBody list of userIds
1199
+ * @returns AffectedRecords
1200
+ */
1201
+ unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, userIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
1202
+ /**
1203
+ * # Unlink all users from a document
1204
+ *
1205
+ * Permission | Scope | Effect
1206
+ * - | - | -
1207
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
1208
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
1209
+ *
1210
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be removed from the document.
1211
+ *
1212
+ * # Interface
1213
+ * @param schemaIdOrName The id or name of the targeted schema.
1214
+ * @param documentId The id of the targeted document.
1215
+ * @param requestBody list of userIds
1216
+ * @returns AffectedRecords
1217
+ */
1218
+ unlinkAllUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
1219
+ }
1220
+ export interface DataIndexesService {
1221
+ /**
1222
+ * Create an index
1223
+ *
1224
+ * Set an index on a specific property in a schema.
1225
+ *
1226
+ * Permission | Scope | Effect
1227
+ * - | - | -
1228
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint: Create an index
1229
+ * @param schemaIdOrName The id or name of the targeted schema.
1230
+ * @param requestBody
1231
+ * @returns Index Success
1232
+ * @throws {ResourceAlreadyExistsError}
1233
+ * @throws {IllegalArgumentError}
1234
+ * @throws {IllegalStateError}
1235
+ */
1236
+ create(schemaIdOrName: ObjectId | string, requestBody: IndexInput, options?: OptionsBase): Promise<Index>;
1237
+ /**
1238
+ * Delete an existing index
1239
+ *
1240
+ * Delete an index for a specific property in a schema.
1241
+ *
1242
+ * Permission | Scope | Effect
1243
+ * - | - | -
1244
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint: Delete an index
1245
+ * @param indexId The id of the targeted index.
1246
+ * @param schemaIdOrName The id or name of the targeted schema.
1247
+ * @returns AffectedRecords
1248
+ * @throws {NoPermissionError}
1249
+ * @throws {ResourceUnknownError}
1250
+ */
1251
+ remove(indexId: ObjectId, schemaIdOrName: ObjectId | string, options?: OptionsBase): Promise<AffectedRecords>;
1252
+ }
1253
+ export interface DataPropertiesService {
1254
+ /**
1255
+ * Create a property
1256
+ *
1257
+ * Permission | Scope | Effect
1258
+ * - | - | -
1259
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1260
+ * @param schemaIdOrName The id or name of the targeted schema.
1261
+ * @param requestBody The name and configuration
1262
+ * @returns AffectedRecords
1263
+ * @throws {ResourceAlreadyExistsError}
1264
+ * @throws {IllegalArgumentError}
1265
+ * @throws {IllegalStateException}
1266
+ * @throws {ResourceUnknownException}
1267
+ */
1268
+ create(schemaIdOrName: ObjectId | string, requestBody: {
1269
+ name: string;
1270
+ configuration: TypeConfiguration;
1271
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1272
+ /**
1273
+ * Delete a property
1274
+ *
1275
+ * Permission | Scope | Effect
1276
+ * - | - | -
1277
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1278
+ * @param schemaIdOrName The id or name of the targeted schema.
1279
+ * @param propertyPath The path to the property
1280
+ * @returns AffectedRecords
1281
+ * @throws {IllegalArgumentError}
1282
+ * @throws {ResourceUnknownError}
1283
+ */
1284
+ remove(schemaIdOrName: ObjectId | string, propertyPath: string, options?: OptionsBase): Promise<AffectedRecords>;
1285
+ /**
1286
+ * Update a property
1287
+ *
1288
+ * Permission | Scope | Effect
1289
+ * - | - | -
1290
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1291
+ * @param schemaIdOrName The id or name of the targeted schema.
1292
+ * @param propertyPath The path to the property
1293
+ * @param requestBody The configuration
1294
+ * @returns AffectedRecords
1295
+ * @throws {IllegalArgumentError}
1296
+ * @throws {ResourceUnknownError}
1297
+ */
1298
+ update(schemaIdOrName: ObjectId | string, propertyPath: string, requestBody: TypeConfiguration, options?: OptionsBase): Promise<AffectedRecords>;
1299
+ }
1300
+ export interface DataSchemasService {
1301
+ /**
1302
+ * Create a schema
1303
+ *
1304
+ * Permission | Scope | Effect
1305
+ * - | - | -
1306
+ * `CREATE_SCHEMAS` | `global` | **Required** for this endpoint
1307
+ * @param requestBody
1308
+ * @returns Schema successful operation
1309
+ */
1310
+ create(requestBody: SchemaInput, options?: OptionsBase): Promise<Schema>;
1311
+ /**
1312
+ * Request a list of schemas
1313
+ *
1314
+ * Permission | Scope | Effect
1315
+ * - | - | -
1316
+ * none | | Every one can use this endpoint
1317
+ * `DISABLE_SCHEMAS` | `global` | Includes disabled schemas in the response
1318
+ * @returns PagedResultWithPager<Schema>
1319
+ */
1320
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<Schema>>;
1321
+ /**
1322
+ * Request a list of all schemas
1323
+ *
1324
+ * Do not pass in an rql with limit operator!
1325
+ *
1326
+ * Permission | Scope | Effect
1327
+ * - | - | -
1328
+ * none | | Every one can use this endpoint
1329
+ * `DISABLE_SCHEMAS` | `global` | Includes disabled schemas in the response
1330
+ * @returns Schema[]
1331
+ */
1332
+ findAll(options?: OptionsWithRql): Promise<Schema[]>;
1333
+ /**
1334
+ * Request a list of all schemas and returns a generator
1335
+ *
1336
+ * Permission | Scope | Effect
1337
+ * - | - | -
1338
+ * none | | Every one can use this endpoint
1339
+ * `DISABLE_SCHEMAS` | `global` | Includes disabled schemas in the response
1340
+ * @returns Schema[]
1341
+ */
1342
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Schema>;
1343
+ /**
1344
+ * Find By Id
1345
+ * @param id the Id to search for
1346
+ * @returns the first element found
1347
+ */
1348
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Schema | undefined>;
1349
+ /**
1350
+ * Find By Name
1351
+ * @param name the name to search for
1352
+ * @returns the first element found
1353
+ */
1354
+ findByName(name: string, options?: OptionsWithRql): Promise<Schema | undefined>;
1355
+ /**
1356
+ * Find First
1357
+ * @returns the first element found
1358
+ */
1359
+ findFirst(options?: OptionsWithRql): Promise<Schema | undefined>;
1360
+ /**
1361
+ * Update a schema
1362
+ *
1363
+ * Permission | Scope | Effect
1364
+ * - | - | -
1365
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1366
+ * @param schemaIdOrName The id or name of the targeted schema.
1367
+ * @param requestBody The schema input
1368
+ * @returns AffectedRecords
1369
+ */
1370
+ update(schemaIdOrName: ObjectId | string, requestBody: UpdateSchemaInput, options?: OptionsWithRql): Promise<AffectedRecords>;
1371
+ /**
1372
+ * Delete a schema
1373
+ *
1374
+ * Permission | Scope | Effect
1375
+ * - | - | -
1376
+ * `DELETE_SCHEMAS` | `global` | **Required** for this endpoint
1377
+ * @param schemaIdOrName The id or name of the targeted schema.
1378
+ * @returns AffectedRecords
1379
+ * @throws {IllegalStateError}
1380
+ */
1381
+ remove(schemaIdOrName: ObjectId | string, options?: OptionsBase): Promise<AffectedRecords>;
1382
+ /**
1383
+ * Disable a schema
1384
+ *
1385
+ * Permission | Scope | Effect
1386
+ * - | - | -
1387
+ * `DISABLE_SCHEMAS` | `global` | **Required** for this endpoint
1388
+ * @param schemaIdOrName The id or name of the targeted schema.
1389
+ * @returns AffectedRecords
1390
+ */
1391
+ disable(schemaIdOrName: ObjectId | string, options?: OptionsBase): Promise<AffectedRecords>;
1392
+ /**
1393
+ * Enable a schema
1394
+ *
1395
+ * Permission | Scope | Effect
1396
+ * - | - | -
1397
+ * `DISABLE_SCHEMAS` | `global` | **Required** for this endpoint
1398
+ * @param schemaIdOrName The id or name of the targeted schema.
1399
+ * @returns AffectedRecords
1400
+ */
1401
+ enable(schemaIdOrName: ObjectId | string, options?: OptionsBase): Promise<AffectedRecords>;
1402
+ }
1403
+ export interface DataStatusesService {
1404
+ /**
1405
+ * Create a status
1406
+ *
1407
+ * Permission | Scope | Effect
1408
+ * - | - | -
1409
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1410
+ * @param schemaIdOrName The id or name of the targeted schema.
1411
+ * @param requestBody The name and status data
1412
+ * @returns AffectedRecords
1413
+ * @throws {ResourceAlreadyExistsError}
1414
+ */
1415
+ create(schemaIdOrName: ObjectId | string, requestBody: {
1416
+ name: string;
1417
+ data?: StatusData;
1418
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1419
+ /**
1420
+ * Update a status
1421
+ *
1422
+ * Permission | Scope | Effect
1423
+ * - | - | -
1424
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1425
+ * @param schemaIdOrName The id or name of the targeted schema.
1426
+ * @param name The name of the targeted status.
1427
+ * @param requestBody The status data
1428
+ * @returns AffectedRecords
1429
+ * @throws {ResourceUnknownError}
1430
+ */
1431
+ update(schemaIdOrName: ObjectId | string, name: string, requestBody: {
1432
+ data: StatusData;
1433
+ }, options?: OptionsBase): Promise<AffectedRecords>;
1434
+ /**
1435
+ * Delete a status
1436
+ *
1437
+ * Permission | Scope | Effect
1438
+ * - | - | -
1439
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1440
+ * @param schemaIdOrName The id or name of the targeted schema.
1441
+ * @param name The name of the targeted status.
1442
+ * @returns AffectedRecords
1443
+ * @throws {StatusInUseError}
1444
+ * @throws {ResourceUnknownError}
1445
+ */
1446
+ remove(schemaIdOrName: ObjectId | string, name: string, options?: OptionsBase): Promise<AffectedRecords>;
1447
+ }
1448
+ export interface DataTransitionsService {
1449
+ /**
1450
+ * Update the creation transition
1451
+ *
1452
+ * Permission | Scope | Effect
1453
+ * - | - | -
1454
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1455
+ * @param schemaIdOrName The id or name of the targeted schema.
1456
+ * @param requestBody
1457
+ * @returns {Promise<AffectedRecords>}
1458
+ * @throws {IllegalArgumentError}
1459
+ */
1460
+ updateCreation(schemaIdOrName: ObjectId | string, requestBody: CreationTransition, options?: OptionsBase): Promise<AffectedRecords>;
1461
+ /**
1462
+ * Create a transition
1463
+ *
1464
+ * Permission | Scope | Effect
1465
+ * - | - | -
1466
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1467
+ * @param schemaIdOrName The id or name of the targeted schema.
1468
+ * @param requestBody TransitionInput
1469
+ * @returns {Promise<AffectedRecords>}
1470
+ * @throws {IllegalArgumentError}
1471
+ */
1472
+ create(schemaIdOrName: ObjectId | string, requestBody: TransitionInput, options?: OptionsBase): Promise<Transition>;
1473
+ /**
1474
+ * Update a transition
1475
+ *
1476
+ * Permission | Scope | Effect
1477
+ * - | - | -
1478
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1479
+ * @param schemaIdOrName The id or name of the targeted schema.
1480
+ * @param transitionId The id of the targeted transition.
1481
+ * @param requestBody
1482
+ * @returns {Promise<AffectedRecords>}
1483
+ * @throws {IllegalArgumentError}
1484
+ * @throws {ResourceUnknownError}
1485
+ */
1486
+ update(schemaIdOrName: ObjectId | string, transitionId: ObjectId, requestBody: TransitionInput, options?: OptionsBase): Promise<AffectedRecords>;
1487
+ /**
1488
+ * Delete a transition
1489
+ *
1490
+ * Permission | Scope | Effect
1491
+ * - | - | -
1492
+ * `UPDATE_SCHEMAS` | `global` | **Required** for this endpoint
1493
+ * @param schemaIdOrName The id or name of the targeted schema.
1494
+ * @param transitionId The id of the targeted transition.
1495
+ * @returns {Promise<AffectedRecords>}
1496
+ * @throws {ResourceUnknownError}
1497
+ */
1498
+ remove(schemaIdOrName: ObjectId | string, transitionId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
1499
+ }
1500
+ export {};