@icure/api 8.6.5 → 8.6.6
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.
- package/icc-api/api/IccFormApi.d.ts +81 -0
- package/icc-api/api/IccFormApi.js +213 -0
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/model/CryptoActorStub.d.ts +0 -2
- package/icc-api/model/CryptoActorStub.js.map +1 -1
- package/icc-api/model/Device.d.ts +0 -1
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/HealthcareParty.d.ts +0 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/Patient.d.ts +0 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-x-api/crypto/CryptoStrategies.d.ts +1 -2
- package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -2
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +93 -0
- package/icc-x-api/icc-accesslog-x-api.js +93 -0
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +122 -0
- package/icc-x-api/icc-calendar-item-x-api.js +122 -0
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +20 -0
- package/icc-x-api/icc-classification-x-api.js +20 -0
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-code-x-api.d.ts +23 -0
- package/icc-x-api/icc-code-x-api.js +23 -0
- package/icc-x-api/icc-code-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +219 -1
- package/icc-x-api/icc-contact-x-api.js +219 -2
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +14 -3
- package/icc-x-api/icc-data-owner-x-api.js +14 -3
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-device-x-api.d.ts +8 -0
- package/icc-x-api/icc-device-x-api.js +8 -0
- package/icc-x-api/icc-device-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.d.ts +26 -0
- package/icc-x-api/icc-doctemplate-x-api.js +26 -0
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +114 -1
- package/icc-x-api/icc-document-x-api.js +127 -1
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +34 -4
- package/icc-x-api/icc-form-x-api.js +34 -4
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +67 -0
- package/icc-x-api/icc-hcparty-x-api.js +67 -0
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +141 -0
- package/icc-x-api/icc-helement-x-api.js +141 -0
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +54 -0
- package/icc-x-api/icc-invoice-x-api.js +54 -0
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +162 -0
- package/icc-x-api/icc-message-x-api.js +162 -0
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +245 -0
- package/icc-x-api/icc-patient-x-api.js +245 -1
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +25 -0
- package/icc-x-api/icc-receipt-x-api.js +25 -0
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +25 -0
- package/icc-x-api/icc-user-x-api.js +25 -0
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-x-api/icc-form-x-api.js +265 -1
- package/test/icc-x-api/icc-form-x-api.js.map +1 -1
- package/test/utils/roles.js +5 -0
- package/test/utils/roles.js.map +1 -1
- package/test/utils/test_utils.js +1 -21
- package/test/utils/test_utils.js.map +1 -1
- package/test/support/CSM-729.d.ts +0 -1
- package/test/support/CSM-729.js +0 -225
- package/test/support/CSM-729.js.map +0 -1
|
@@ -24,6 +24,14 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
|
|
|
24
24
|
constructor(host: string, headers: {
|
|
25
25
|
[key: string]: string;
|
|
26
26
|
}, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, autofillAuthor: boolean, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new instance of calendar item with initialised encryption metadata (not in the database), without
|
|
29
|
+
* linking it to a patient. Use {@link newInstancePatient} to create a calendar item linked to a patient.
|
|
30
|
+
* @param user the current user.
|
|
31
|
+
* @param ci initialised data for the calendar item.
|
|
32
|
+
* @param options optional parameters for delegates and root delegation.
|
|
33
|
+
* @return a new instance of calendar item.
|
|
34
|
+
*/
|
|
27
35
|
newInstance(user: User, ci: any | CalendarItem, options?: {
|
|
28
36
|
additionalDelegates?: {
|
|
29
37
|
[dataOwnerId: string]: AccessLevelEnum;
|
|
@@ -70,30 +78,110 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
|
|
|
70
78
|
* @deprecated use {@link findCalendarItemIdsByDataOwnerPatientStartTime} instead.
|
|
71
79
|
*/
|
|
72
80
|
findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<models.CalendarItem> | any>;
|
|
81
|
+
/**
|
|
82
|
+
* @throws always. Use {@link createCalendarItemWithHcParty} instead.
|
|
83
|
+
*/
|
|
73
84
|
createCalendarItem(body?: CalendarItem): never;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a calendar item after encrypting its content.
|
|
87
|
+
* @param user the current user, used for encryption.
|
|
88
|
+
* @param body the calendar item to create.
|
|
89
|
+
* @return the created and decrypted calendar item.
|
|
90
|
+
*/
|
|
74
91
|
createCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any>;
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a calendar item by id and decrypts it.
|
|
94
|
+
* @param user the current user, used for decryption.
|
|
95
|
+
* @param calendarItemId the id of the calendar item to retrieve.
|
|
96
|
+
* @return the decrypted calendar item.
|
|
97
|
+
*/
|
|
75
98
|
getCalendarItemWithUser(user: models.User, calendarItemId: string): Promise<CalendarItem | any>;
|
|
99
|
+
/**
|
|
100
|
+
* @throws always. Use {@link getCalendarItemWithUser} instead.
|
|
101
|
+
*/
|
|
76
102
|
getCalendarItem(calendarItemId: string): never;
|
|
77
103
|
/**
|
|
78
104
|
* @deprecated use {@link getCalendarItemsWithPaginationWithUser} instead.
|
|
79
105
|
*/
|
|
80
106
|
getCalendarItemsWithUser(user: models.User): Promise<Array<CalendarItem> | any>;
|
|
107
|
+
/**
|
|
108
|
+
* @throws always. Use {@link getCalendarItemsWithPaginationWithUser} instead.
|
|
109
|
+
*/
|
|
81
110
|
getCalendarItems(): never;
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves calendar items with pagination and decrypts them.
|
|
113
|
+
* @param user the current user, used for decryption.
|
|
114
|
+
* @param startDocumentId the pagination start document id.
|
|
115
|
+
* @param limit the maximum number of results to return.
|
|
116
|
+
* @return a paginated list of decrypted calendar items.
|
|
117
|
+
*/
|
|
82
118
|
getCalendarItemsWithPaginationWithUser(user: models.User, startDocumentId?: string, limit?: number): Promise<PaginatedListCalendarItem>;
|
|
119
|
+
/**
|
|
120
|
+
* @throws always. Use {@link getCalendarItemsWithPaginationWithUser} instead.
|
|
121
|
+
*/
|
|
83
122
|
getCalendarItemsWithPagination(startDocumentId?: string, limit?: number): never;
|
|
84
123
|
/**
|
|
85
124
|
* @deprecated use {@link findCalendarItemsByRecurrenceIdWithPaginationWithUser} instead.
|
|
86
125
|
*/
|
|
87
126
|
findCalendarItemsByRecurrenceIdWithUser(user: models.User, recurrenceId: string): Promise<Array<CalendarItem> | any>;
|
|
127
|
+
/**
|
|
128
|
+
* @throws always. Use {@link findCalendarItemsByRecurrenceIdWithPaginationWithUser} instead.
|
|
129
|
+
*/
|
|
88
130
|
findCalendarItemsByRecurrenceId(recurrenceId: string): never;
|
|
131
|
+
/**
|
|
132
|
+
* Finds calendar items by recurrence id with pagination and decrypts them.
|
|
133
|
+
* @param user the current user, used for decryption.
|
|
134
|
+
* @param recurrenceId the recurrence id to search for.
|
|
135
|
+
* @param startKey the pagination start key.
|
|
136
|
+
* @param startDocumentId the pagination start document id.
|
|
137
|
+
* @param limit the maximum number of results to return.
|
|
138
|
+
* @return a paginated list of decrypted calendar items matching the recurrence id.
|
|
139
|
+
*/
|
|
89
140
|
findCalendarItemsByRecurrenceIdWithPaginationWithUser(user: models.User, recurrenceId: string, startKey?: string, startDocumentId?: string, limit?: number): Promise<PaginatedListCalendarItem>;
|
|
141
|
+
/**
|
|
142
|
+
* @throws always. Use {@link findCalendarItemsByRecurrenceIdWithPaginationWithUser} instead.
|
|
143
|
+
*/
|
|
90
144
|
findCalendarItemsByRecurrenceIdWithPagination(recurrenceId: string, startKey?: string, startDocumentId?: string, limit?: number): never;
|
|
145
|
+
/**
|
|
146
|
+
* Retrieves multiple calendar items by their ids and decrypts them.
|
|
147
|
+
* @param user the current user, used for decryption.
|
|
148
|
+
* @param body the list of calendar item ids to retrieve.
|
|
149
|
+
* @return the decrypted calendar items.
|
|
150
|
+
*/
|
|
91
151
|
getCalendarItemsWithIdsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<CalendarItem> | any>;
|
|
152
|
+
/**
|
|
153
|
+
* @throws always. Use {@link getCalendarItemsWithIdsWithUser} instead.
|
|
154
|
+
*/
|
|
92
155
|
getCalendarItemsWithIds(body?: models.ListOfIds): never;
|
|
156
|
+
/**
|
|
157
|
+
* Retrieves calendar items for a given healthcare party within a date range and decrypts them.
|
|
158
|
+
* @param user the current user, used for decryption.
|
|
159
|
+
* @param startDate the start of the date range.
|
|
160
|
+
* @param endDate the end of the date range.
|
|
161
|
+
* @param hcPartyId the id of the healthcare party.
|
|
162
|
+
* @return the decrypted calendar items.
|
|
163
|
+
*/
|
|
93
164
|
getCalendarItemsByPeriodAndHcPartyIdWithUser(user: models.User, startDate: number, endDate: number, hcPartyId: string): Promise<Array<CalendarItem> | any>;
|
|
165
|
+
/**
|
|
166
|
+
* @throws always. Use {@link getCalendarItemsByPeriodAndHcPartyIdWithUser} instead.
|
|
167
|
+
*/
|
|
94
168
|
getCalendarItemsByPeriodAndHcPartyId(startDate?: number, endDate?: number, hcPartyId?: string): never;
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves calendar items for a given agenda within a date range and decrypts them.
|
|
171
|
+
* @param user the current user, used for decryption.
|
|
172
|
+
* @param startDate the start of the date range.
|
|
173
|
+
* @param endDate the end of the date range.
|
|
174
|
+
* @param agendaId the id of the agenda.
|
|
175
|
+
* @return the decrypted calendar items.
|
|
176
|
+
*/
|
|
95
177
|
getCalendarsByPeriodAndAgendaIdWithUser(user: models.User, startDate: number, endDate: number, agendaId: string): Promise<Array<CalendarItem> | any>;
|
|
178
|
+
/**
|
|
179
|
+
* @throws always. Use {@link getCalendarsByPeriodAndAgendaIdWithUser} instead.
|
|
180
|
+
*/
|
|
96
181
|
getCalendarsByPeriodAndAgendaId(startDate?: number, endDate?: number, agendaId?: string): never;
|
|
182
|
+
/**
|
|
183
|
+
* @throws always. Use {@link modifyCalendarItemWithHcParty} instead.
|
|
184
|
+
*/
|
|
97
185
|
modifyCalendarItem(body?: CalendarItem): never;
|
|
98
186
|
/**
|
|
99
187
|
* Remove the following delegation objects from the
|
|
@@ -107,10 +195,28 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
|
|
|
107
195
|
* @param calendarItem The Calendar Item object
|
|
108
196
|
*/
|
|
109
197
|
resetCalendarDelegationObjects(calendarItem: models.CalendarItem): models.CalendarItem;
|
|
198
|
+
/**
|
|
199
|
+
* Modifies a calendar item after encrypting its content.
|
|
200
|
+
* @param user the current user, used for encryption/decryption.
|
|
201
|
+
* @param body the calendar item with updated fields.
|
|
202
|
+
* @return the modified and decrypted calendar item, or null if body was not provided.
|
|
203
|
+
*/
|
|
110
204
|
modifyCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any>;
|
|
111
205
|
private modifyAs;
|
|
206
|
+
/**
|
|
207
|
+
* Encrypts the encrypted fields of a list of calendar items.
|
|
208
|
+
* @param user the current user, used to determine the data owner for encryption.
|
|
209
|
+
* @param calendarItems the calendar items to encrypt.
|
|
210
|
+
* @return the encrypted calendar items.
|
|
211
|
+
*/
|
|
112
212
|
encrypt(user: models.User, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>>;
|
|
113
213
|
private encryptAs;
|
|
214
|
+
/**
|
|
215
|
+
* Decrypts a list of calendar items using the current data owner's keys.
|
|
216
|
+
* @param hcpId the id of the healthcare party performing the decryption.
|
|
217
|
+
* @param calendarItems the calendar items to decrypt.
|
|
218
|
+
* @return the decrypted calendar items.
|
|
219
|
+
*/
|
|
114
220
|
decrypt(hcpId: string, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>>;
|
|
115
221
|
/**
|
|
116
222
|
* @param calendarItem a calendar item
|
|
@@ -188,12 +294,22 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
|
|
|
188
294
|
sharePatientId?: ShareMetadataBehaviour;
|
|
189
295
|
};
|
|
190
296
|
}): Promise<ShareResult<models.CalendarItem>>;
|
|
297
|
+
/**
|
|
298
|
+
* Retrieves the data owners that have access to the given calendar item, along with their access levels.
|
|
299
|
+
* @param entity the calendar item.
|
|
300
|
+
* @return an object containing a map of data owner ids to their access levels, and a flag indicating if there are unknown anonymous data owners.
|
|
301
|
+
*/
|
|
191
302
|
getDataOwnersWithAccessTo(entity: CalendarItem): Promise<{
|
|
192
303
|
permissionsByDataOwnerId: {
|
|
193
304
|
[p: string]: AccessLevelEnum;
|
|
194
305
|
};
|
|
195
306
|
hasUnknownAnonymousDataOwners: boolean;
|
|
196
307
|
}>;
|
|
308
|
+
/**
|
|
309
|
+
* Retrieves the encryption keys of the given calendar item.
|
|
310
|
+
* @param entity the calendar item.
|
|
311
|
+
* @return the encryption key ids.
|
|
312
|
+
*/
|
|
197
313
|
getEncryptionKeysOf(entity: CalendarItem): Promise<string[]>;
|
|
198
314
|
/**
|
|
199
315
|
* Adds a bidirectional link between a calendar item with a patient.
|
|
@@ -227,5 +343,11 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
|
|
|
227
343
|
* @return the updated calendar item
|
|
228
344
|
*/
|
|
229
345
|
addLinkFromPatient(calendarItem: CalendarItem, patient: models.Patient, sfkOption?: SecretIdUseOption): Promise<CalendarItem>;
|
|
346
|
+
/**
|
|
347
|
+
* Creates or updates de-anonymization metadata for the given calendar item, allowing the specified delegates to
|
|
348
|
+
* identify the data owners that have access to it.
|
|
349
|
+
* @param entity the calendar item.
|
|
350
|
+
* @param delegates the data owner ids for which to create de-anonymization metadata.
|
|
351
|
+
*/
|
|
230
352
|
createDelegationDeAnonymizationMetadata(entity: CalendarItem, delegates: string[]): Promise<void>;
|
|
231
353
|
}
|
|
@@ -49,6 +49,14 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
49
49
|
this.dataOwnerApi = dataOwnerApi;
|
|
50
50
|
this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'CalendarItem.');
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new instance of calendar item with initialised encryption metadata (not in the database), without
|
|
54
|
+
* linking it to a patient. Use {@link newInstancePatient} to create a calendar item linked to a patient.
|
|
55
|
+
* @param user the current user.
|
|
56
|
+
* @param ci initialised data for the calendar item.
|
|
57
|
+
* @param options optional parameters for delegates and root delegation.
|
|
58
|
+
* @return a new instance of calendar item.
|
|
59
|
+
*/
|
|
52
60
|
newInstance(user, ci, options = {}) {
|
|
53
61
|
return this.newInstancePatient(user, null, ci, options);
|
|
54
62
|
}
|
|
@@ -130,9 +138,18 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
130
138
|
.findCalendarItemsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys)
|
|
131
139
|
.then((calendarItems) => this.decrypt(hcPartyId, calendarItems));
|
|
132
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* @throws always. Use {@link createCalendarItemWithHcParty} instead.
|
|
143
|
+
*/
|
|
133
144
|
createCalendarItem(body) {
|
|
134
145
|
throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption');
|
|
135
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Creates a calendar item after encrypting its content.
|
|
149
|
+
* @param user the current user, used for encryption.
|
|
150
|
+
* @param body the calendar item to create.
|
|
151
|
+
* @return the created and decrypted calendar item.
|
|
152
|
+
*/
|
|
136
153
|
createCalendarItemWithHcParty(user, body) {
|
|
137
154
|
const _super = Object.create(null, {
|
|
138
155
|
createCalendarItem: { get: () => super.createCalendarItem }
|
|
@@ -146,12 +163,21 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
146
163
|
: null;
|
|
147
164
|
});
|
|
148
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Retrieves a calendar item by id and decrypts it.
|
|
168
|
+
* @param user the current user, used for decryption.
|
|
169
|
+
* @param calendarItemId the id of the calendar item to retrieve.
|
|
170
|
+
* @return the decrypted calendar item.
|
|
171
|
+
*/
|
|
149
172
|
getCalendarItemWithUser(user, calendarItemId) {
|
|
150
173
|
return super
|
|
151
174
|
.getCalendarItem(calendarItemId)
|
|
152
175
|
.then((calendarItem) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), [calendarItem]))
|
|
153
176
|
.then((cis) => cis[0]);
|
|
154
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* @throws always. Use {@link getCalendarItemWithUser} instead.
|
|
180
|
+
*/
|
|
155
181
|
getCalendarItem(calendarItemId) {
|
|
156
182
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
157
183
|
}
|
|
@@ -166,9 +192,19 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
166
192
|
return _super.getCalendarItems.call(this).then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems));
|
|
167
193
|
});
|
|
168
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* @throws always. Use {@link getCalendarItemsWithPaginationWithUser} instead.
|
|
197
|
+
*/
|
|
169
198
|
getCalendarItems() {
|
|
170
199
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
171
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves calendar items with pagination and decrypts them.
|
|
203
|
+
* @param user the current user, used for decryption.
|
|
204
|
+
* @param startDocumentId the pagination start document id.
|
|
205
|
+
* @param limit the maximum number of results to return.
|
|
206
|
+
* @return a paginated list of decrypted calendar items.
|
|
207
|
+
*/
|
|
172
208
|
getCalendarItemsWithPaginationWithUser(user, startDocumentId, limit) {
|
|
173
209
|
const _super = Object.create(null, {
|
|
174
210
|
getCalendarItemsWithPagination: { get: () => super.getCalendarItemsWithPagination }
|
|
@@ -183,6 +219,9 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
183
219
|
});
|
|
184
220
|
});
|
|
185
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* @throws always. Use {@link getCalendarItemsWithPaginationWithUser} instead.
|
|
224
|
+
*/
|
|
186
225
|
getCalendarItemsWithPagination(startDocumentId, limit) {
|
|
187
226
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
188
227
|
}
|
|
@@ -198,9 +237,21 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
198
237
|
.then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems));
|
|
199
238
|
});
|
|
200
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* @throws always. Use {@link findCalendarItemsByRecurrenceIdWithPaginationWithUser} instead.
|
|
242
|
+
*/
|
|
201
243
|
findCalendarItemsByRecurrenceId(recurrenceId) {
|
|
202
244
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
203
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Finds calendar items by recurrence id with pagination and decrypts them.
|
|
248
|
+
* @param user the current user, used for decryption.
|
|
249
|
+
* @param recurrenceId the recurrence id to search for.
|
|
250
|
+
* @param startKey the pagination start key.
|
|
251
|
+
* @param startDocumentId the pagination start document id.
|
|
252
|
+
* @param limit the maximum number of results to return.
|
|
253
|
+
* @return a paginated list of decrypted calendar items matching the recurrence id.
|
|
254
|
+
*/
|
|
204
255
|
findCalendarItemsByRecurrenceIdWithPaginationWithUser(user, recurrenceId, startKey, startDocumentId, limit) {
|
|
205
256
|
const _super = Object.create(null, {
|
|
206
257
|
findCalendarItemsByRecurrenceIdWithPagination: { get: () => super.findCalendarItemsByRecurrenceIdWithPagination }
|
|
@@ -215,31 +266,68 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
215
266
|
});
|
|
216
267
|
});
|
|
217
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* @throws always. Use {@link findCalendarItemsByRecurrenceIdWithPaginationWithUser} instead.
|
|
271
|
+
*/
|
|
218
272
|
findCalendarItemsByRecurrenceIdWithPagination(recurrenceId, startKey, startDocumentId, limit) {
|
|
219
273
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
220
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Retrieves multiple calendar items by their ids and decrypts them.
|
|
277
|
+
* @param user the current user, used for decryption.
|
|
278
|
+
* @param body the list of calendar item ids to retrieve.
|
|
279
|
+
* @return the decrypted calendar items.
|
|
280
|
+
*/
|
|
221
281
|
getCalendarItemsWithIdsWithUser(user, body) {
|
|
222
282
|
return super.getCalendarItemsWithIds(body).then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems));
|
|
223
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* @throws always. Use {@link getCalendarItemsWithIdsWithUser} instead.
|
|
286
|
+
*/
|
|
224
287
|
getCalendarItemsWithIds(body) {
|
|
225
288
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
226
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Retrieves calendar items for a given healthcare party within a date range and decrypts them.
|
|
292
|
+
* @param user the current user, used for decryption.
|
|
293
|
+
* @param startDate the start of the date range.
|
|
294
|
+
* @param endDate the end of the date range.
|
|
295
|
+
* @param hcPartyId the id of the healthcare party.
|
|
296
|
+
* @return the decrypted calendar items.
|
|
297
|
+
*/
|
|
227
298
|
getCalendarItemsByPeriodAndHcPartyIdWithUser(user, startDate, endDate, hcPartyId) {
|
|
228
299
|
return super
|
|
229
300
|
.getCalendarItemsByPeriodAndHcPartyId(startDate, endDate, hcPartyId)
|
|
230
301
|
.then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems));
|
|
231
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* @throws always. Use {@link getCalendarItemsByPeriodAndHcPartyIdWithUser} instead.
|
|
305
|
+
*/
|
|
232
306
|
getCalendarItemsByPeriodAndHcPartyId(startDate, endDate, hcPartyId) {
|
|
233
307
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
234
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Retrieves calendar items for a given agenda within a date range and decrypts them.
|
|
311
|
+
* @param user the current user, used for decryption.
|
|
312
|
+
* @param startDate the start of the date range.
|
|
313
|
+
* @param endDate the end of the date range.
|
|
314
|
+
* @param agendaId the id of the agenda.
|
|
315
|
+
* @return the decrypted calendar items.
|
|
316
|
+
*/
|
|
235
317
|
getCalendarsByPeriodAndAgendaIdWithUser(user, startDate, endDate, agendaId) {
|
|
236
318
|
return super
|
|
237
319
|
.getCalendarsByPeriodAndAgendaId(startDate, endDate, agendaId)
|
|
238
320
|
.then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems));
|
|
239
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* @throws always. Use {@link getCalendarsByPeriodAndAgendaIdWithUser} instead.
|
|
324
|
+
*/
|
|
240
325
|
getCalendarsByPeriodAndAgendaId(startDate, endDate, agendaId) {
|
|
241
326
|
throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption');
|
|
242
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* @throws always. Use {@link modifyCalendarItemWithHcParty} instead.
|
|
330
|
+
*/
|
|
243
331
|
modifyCalendarItem(body) {
|
|
244
332
|
throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption');
|
|
245
333
|
}
|
|
@@ -258,6 +346,12 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
258
346
|
const { cryptedForeignKeys, secretForeignKeys } = calendarItem, resetCalendarItem = __rest(calendarItem, ["cryptedForeignKeys", "secretForeignKeys"]);
|
|
259
347
|
return resetCalendarItem;
|
|
260
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Modifies a calendar item after encrypting its content.
|
|
351
|
+
* @param user the current user, used for encryption/decryption.
|
|
352
|
+
* @param body the calendar item with updated fields.
|
|
353
|
+
* @return the modified and decrypted calendar item, or null if body was not provided.
|
|
354
|
+
*/
|
|
261
355
|
modifyCalendarItemWithHcParty(user, body) {
|
|
262
356
|
return __awaiter(this, void 0, void 0, function* () {
|
|
263
357
|
return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), _.cloneDeep(body)) : null;
|
|
@@ -269,12 +363,24 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
269
363
|
.then((ci) => this.decrypt(dataOwner, [ci]))
|
|
270
364
|
.then((cis) => cis[0]);
|
|
271
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Encrypts the encrypted fields of a list of calendar items.
|
|
368
|
+
* @param user the current user, used to determine the data owner for encryption.
|
|
369
|
+
* @param calendarItems the calendar items to encrypt.
|
|
370
|
+
* @return the encrypted calendar items.
|
|
371
|
+
*/
|
|
272
372
|
encrypt(user, calendarItems) {
|
|
273
373
|
return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems);
|
|
274
374
|
}
|
|
275
375
|
encryptAs(dataOwner, calendarItems) {
|
|
276
376
|
return this.crypto.xapi.tryEncryptEntities(calendarItems, utils_1.EntityWithDelegationTypeName.CalendarItem, this.encryptedFields, false, false, (json) => new models_1.CalendarItem(json));
|
|
277
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Decrypts a list of calendar items using the current data owner's keys.
|
|
380
|
+
* @param hcpId the id of the healthcare party performing the decryption.
|
|
381
|
+
* @param calendarItems the calendar items to decrypt.
|
|
382
|
+
* @return the decrypted calendar items.
|
|
383
|
+
*/
|
|
278
384
|
decrypt(hcpId, calendarItems) {
|
|
279
385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
386
|
return (yield this.crypto.xapi.tryDecryptEntities(calendarItems, utils_1.EntityWithDelegationTypeName.CalendarItem, (json) => new models_1.CalendarItem(json))).map(({ entity }) => entity);
|
|
@@ -374,9 +480,19 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
374
480
|
.then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
|
|
375
481
|
});
|
|
376
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Retrieves the data owners that have access to the given calendar item, along with their access levels.
|
|
485
|
+
* @param entity the calendar item.
|
|
486
|
+
* @return an object containing a map of data owner ids to their access levels, and a flag indicating if there are unknown anonymous data owners.
|
|
487
|
+
*/
|
|
377
488
|
getDataOwnersWithAccessTo(entity) {
|
|
378
489
|
return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: utils_1.EntityWithDelegationTypeName.CalendarItem });
|
|
379
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* Retrieves the encryption keys of the given calendar item.
|
|
493
|
+
* @param entity the calendar item.
|
|
494
|
+
* @return the encryption key ids.
|
|
495
|
+
*/
|
|
380
496
|
getEncryptionKeysOf(entity) {
|
|
381
497
|
return this.crypto.xapi.encryptionKeysOf({ entity, type: utils_1.EntityWithDelegationTypeName.CalendarItem }, undefined);
|
|
382
498
|
}
|
|
@@ -464,6 +580,12 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
464
580
|
}
|
|
465
581
|
});
|
|
466
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Creates or updates de-anonymization metadata for the given calendar item, allowing the specified delegates to
|
|
585
|
+
* identify the data owners that have access to it.
|
|
586
|
+
* @param entity the calendar item.
|
|
587
|
+
* @param delegates the data owner ids for which to create de-anonymization metadata.
|
|
588
|
+
*/
|
|
467
589
|
createDelegationDeAnonymizationMetadata(entity, delegates) {
|
|
468
590
|
return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: utils_1.EntityWithDelegationTypeName.CalendarItem }, delegates);
|
|
469
591
|
}
|