@icure/cardinal-sdk 2.1.2 → 2.3.0

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.
@@ -367,7 +367,7 @@ function addFormatStructureForDate(structure) {
367
367
  function addFormatStructureForTime(structure) {
368
368
  this.o3z(structure);
369
369
  }
370
- initMetadataForInterface(AbstractWithDateTimeBuilder, 'AbstractWithDateTimeBuilder', VOID, VOID, [AbstractWithDateBuilder, AbstractWithTimeBuilder, WithDate, WithTime]);
370
+ initMetadataForInterface(AbstractWithDateTimeBuilder, 'AbstractWithDateTimeBuilder', VOID, VOID, [AbstractWithDateBuilder, AbstractWithTimeBuilder, WithTime, WithDate]);
371
371
  initMetadataForClass(Builder_0, 'Builder', VOID, VOID, [AbstractDateTimeFormatBuilder, AbstractWithDateTimeBuilder]);
372
372
  initMetadataForClass(LocalDateTimeFormat, 'LocalDateTimeFormat', VOID, AbstractDateTimeFormat);
373
373
  function set_fractionOfSecond(value) {
@@ -16,7 +16,6 @@ import { RoleConfiguration } from '../model/embed/RoleConfiguration.mjs';
16
16
  import { UserType } from '../model/embed/UserType.mjs';
17
17
  import { ExternalJwtConfig } from '../model/security/ExternalJwtConfig.mjs';
18
18
  import { Operation } from '../model/security/Operation.mjs';
19
- import { PermissionType } from '../model/security/PermissionType.mjs';
20
19
  export interface GroupApi {
21
20
  listGroups(): Promise<Array<Group>>;
22
21
  getGroup(id: string): Promise<Group>;
@@ -30,7 +29,6 @@ export interface GroupApi {
30
29
  }): Promise<Group>;
31
30
  registerNewGroupAdministrator(registrationInformation: RegistrationInformation, options?: {
32
31
  type?: GroupType | undefined;
33
- role?: PermissionType | undefined;
34
32
  }): Promise<RegistrationSuccess>;
35
33
  listApps(): Promise<Array<Group>>;
36
34
  findGroups(id: string, options?: {
@@ -26,23 +26,54 @@ export interface RecoveryApi {
26
26
  *
27
27
  * # Important
28
28
  *
29
- * The recovery key must be kept secret can give access to the private key of the user, therefore it must be kept
30
- * private.
29
+ * The recovery key can give access to the private key of the user, therefore it must be kept private.
31
30
  *
32
- * @param includeParentsKeys if true, the recovery data will also contain any available keypairs for parents data
33
- * owners.
31
+ * @param includeParentsKeys if true, the recovery data will also contain any available keypairs for parents (direct
32
+ * or indirect) data owners.
34
33
  * @param lifetimeSeconds the amount of seconds the recovery data will be available. If not provided, the recovery
35
34
  * data will be available until it is explicitly deleted.
36
35
  * @param recoveryKeyOptions specifies the size of the recovery key to generate, or if it should use a precomputed
37
36
  * key.
38
- * @return an hexadecimal string that is the `recoveryKey` which will allow the user to recover his keypair later or
39
- * from another device. This value must be kept secret from other users. You can use this value with {@link recoverKeyPairs}
37
+ * @return a recovery key for the available keypairs
40
38
  */
41
39
  createRecoveryInfoForAvailableKeyPairs(options?: {
42
40
  includeParentsKeys?: boolean;
43
41
  lifetimeSeconds?: number | undefined;
44
42
  recoveryKeyOptions?: RecoveryKeyOptions | undefined;
45
43
  }): Promise<RecoveryDataKey>;
44
+ /**
45
+ *
46
+ * Create recovery data containing available keypairs for a parent hcp of the logged user and stores it encrypted
47
+ * on the iCure server, similarly to [createRecoveryInfoForAvailableKeyPairs].
48
+ *
49
+ * Requires that the current user has the "RecoveryDataManagement.ExtendedCreate.ForParent" permission (or stronger),
50
+ * and that the user for which the data is intended has the "RecoveryDataManagement.ExtendedRead.ForParent"
51
+ *
52
+ * This can be used to let another user that is a child of the same [parentId] to initialize or recover the
53
+ * existing keypairs of the parent data owner.
54
+ *
55
+ * # Important
56
+ *
57
+ * The recovery key can give access to the private key of the parent, therefore it must be kept private or shared
58
+ * only with other users that have the same parent.
59
+ *
60
+ * @param parentId the id of a parent of the current user's data owner
61
+ * @param includeAncestorKeys if true, the recovery data will also contain any available keypairs for parents
62
+ * (direct or indirect) of the [parentId] data owners.
63
+ * @param lifetimeSeconds the amount of seconds the recovery data will be available. If not provided, the recovery
64
+ * data will be available until it is explicitly deleted.
65
+ * @param recoveryKeyOptions specifies the size of the recovery key to generate, or if it should use a precomputed
66
+ * key.
67
+ * @return a recovery key for the available parent keypairs.
68
+ * @throws IllegalArgumentException if the provided [parentId] is not a parent of the current user's data owner, or
69
+ * if the current data owner has no access to any of the parent keys (the sdk was not initialized in hierarchical
70
+ * mode)
71
+ */
72
+ createRecoveryInfoForAvailableParentKeyPairs(parentId: string, options?: {
73
+ includeAncestorKeys?: boolean;
74
+ lifetimeSeconds?: number | undefined;
75
+ recoveryKeyOptions?: RecoveryKeyOptions | undefined;
76
+ }): Promise<RecoveryDataKey>;
46
77
  /**
47
78
  *
48
79
  * Equivalent to [KeyPairRecoverer.recoverWithRecoveryKey]
package/api/UserApi.d.mts CHANGED
@@ -32,11 +32,58 @@ export interface UserApi {
32
32
  filterUsersBySorted(filter: BaseSortableFilterOptions<User>): Promise<PaginatedListIterator<User>>;
33
33
  matchUsersBySorted(filter: BaseSortableFilterOptions<User>): Promise<Array<string>>;
34
34
  getMatchingUsers(): Promise<Array<UserGroup>>;
35
+ /**
36
+ *
37
+ * Configures the roles of a user, replacing the previous ones.
38
+ *
39
+ * By passing an empty list, the user will have no roles, and therefore no permissions. If you intend to change a
40
+ * user roles so that it inherits the default roles of its group, you should use [resetUserRoles] instead.
41
+ */
35
42
  setUserRoles(userId: string, rolesIds: Array<string>): Promise<User>;
43
+ /**
44
+ *
45
+ * If the user has any roles directly assigned to them, they will be removed, and the user will have the
46
+ * default roles for its category as configured in its group.
47
+ *
48
+ * This could increase or decrease the permissions of the user depending on the previous roles and the group
49
+ * configuration.
50
+ */
36
51
  resetUserRoles(userId: string): Promise<User>;
37
52
  enable2faForUser(userId: string, request: Enable2faRequest): Promise<void>;
38
53
  disable2faForUser(userId: string): Promise<void>;
39
54
  createAdminUser(user: User): Promise<User>;
55
+ /**
56
+ *
57
+ * Modify a user password. This method does not require knowing the previous user password so that it can be used
58
+ * even as a "forgot password" flow, but is protected by the "elevated security" mechanism, so it should only be
59
+ * used with a [com.icure.cardinal.sdk.auth.services.SmartAuthProvider] that can provide the required elevated
60
+ * security token if needed.
61
+ *
62
+ * This method should be favored over a simple [modifyUser] when changing the Password as it does not require knowing
63
+ * the revision of the user directly, and can work even if there is a [com.icure.cardinal.sdk.auth.services.SmartAuthProvider]
64
+ * that is modifying the user tokens when performing the request.
65
+ */
66
+ modifyUserPassword(userId: string, newPassword: string): Promise<User>;
67
+ /**
68
+ *
69
+ * Modify a user email given its previous value, throwing a [RevisionConflictException] if the provided
70
+ * [previousEmail] does not match the stored value.
71
+ *
72
+ * This method should be favored over a simple [modifyUser] when changing the Email as it does not require knowing
73
+ * the revision of the user directly, and can work even if there is a [com.icure.cardinal.sdk.auth.services.SmartAuthProvider]
74
+ * that is modifying the user tokens when performing the request.
75
+ */
76
+ modifyUserEmail(userId: string, newEmail: string, previousEmail: string | undefined): Promise<User>;
77
+ /**
78
+ *
79
+ * Modify a user mobile phone given its previous value, throwing a [RevisionConflictException] if the provided
80
+ * [previousMobilePhone] does not match the stored value.
81
+ *
82
+ * This method should be favored over a simple [modifyUser] when changing the MobilePhone as it does not require knowing
83
+ * the revision of the user directly, and can work even if there is a [com.icure.cardinal.sdk.auth.services.SmartAuthProvider]
84
+ * that is modifying the user tokens when performing the request.
85
+ */
86
+ modifyUserMobilePhone(userId: string, newMobilePhone: string, previousMobilePhone: string | undefined): Promise<User>;
40
87
  /**
41
88
  *
42
89
  * Deletes a user. If you don't have write access to the user the method will fail.
@@ -28,7 +28,15 @@ export interface UserInGroupApi {
28
28
  matchUsersBy(groupId: string, filter: BaseFilterOptions<User>): Promise<Array<string>>;
29
29
  filterUsersBySorted(groupId: string, filter: BaseSortableFilterOptions<User>): Promise<PaginatedListIterator<GroupScoped<User>>>;
30
30
  matchUsersBySorted(groupId: string, filter: BaseSortableFilterOptions<User>): Promise<Array<string>>;
31
+ /**
32
+ *
33
+ * In group equivalent of [UserApi.setUserRoles]
34
+ */
31
35
  setUserRoles(user: GroupScoped<User>, rolesIds: Array<string>): Promise<GroupScoped<User>>;
36
+ /**
37
+ *
38
+ * In group equivalent of [UserApi.resetUserRoles]
39
+ */
32
40
  resetUserRoles(user: GroupScoped<User>): Promise<GroupScoped<User>>;
33
41
  getToken(userIdentifier: string, groupId: string, key: string, options?: {
34
42
  token?: string | undefined;
@@ -41,6 +49,21 @@ export interface UserInGroupApi {
41
49
  enable2faForUser(user: GroupScoped<User>, request: Enable2faRequest): Promise<void>;
42
50
  disable2faForUser(user: GroupScoped<User>): Promise<void>;
43
51
  createAdminUser(user: GroupScoped<User>): Promise<GroupScoped<User>>;
52
+ /**
53
+ *
54
+ * In group equivalent of [UserApi.modifyUserPassword]
55
+ */
56
+ modifyUserPassword(groupId: string, userId: string, newPassword: string): Promise<GroupScoped<User>>;
57
+ /**
58
+ *
59
+ * In group equivalent of [UserApi.modifyUserEmail]
60
+ */
61
+ modifyUserEmail(groupId: string, userId: string, newEmail: string, previousEmail: string | undefined): Promise<GroupScoped<User>>;
62
+ /**
63
+ *
64
+ * In group equivalent of [UserApi.modifyUserMobilePhone]
65
+ */
66
+ modifyUserMobilePhone(groupId: string, userId: string, newMobilePhone: string, previousMobilePhone: string | undefined): Promise<GroupScoped<User>>;
44
67
  /**
45
68
  *
46
69
  * Defines if a user inherits the permission they have in their group in all the groups that are children of their group.