@icure/cardinal-sdk 2.0.0-PREVIEW-21 → 2.0.0-PREVIEW-23

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.
@@ -88,8 +88,8 @@ initMetadataForInterface(Entry, 'Entry');
88
88
  initMetadataForInterface(KtMap, 'Map');
89
89
  initMetadataForInterface(KtSet, 'Set', VOID, VOID, [Collection]);
90
90
  initMetadataForInterface(MutableIterable, 'MutableIterable');
91
- initMetadataForInterface(KtMutableList, 'MutableList', VOID, VOID, [KtList, Collection, MutableIterable]);
92
- initMetadataForInterface(KtMutableSet, 'MutableSet', VOID, VOID, [KtSet, Collection, MutableIterable]);
91
+ initMetadataForInterface(KtMutableList, 'MutableList', VOID, VOID, [KtList, MutableIterable, Collection]);
92
+ initMetadataForInterface(KtMutableSet, 'MutableSet', VOID, VOID, [KtSet, MutableIterable, Collection]);
93
93
  initMetadataForInterface(KtMutableMap, 'MutableMap', VOID, VOID, [KtMap]);
94
94
  initMetadataForCompanion(Companion_0);
95
95
  initMetadataForClass(Enum, 'Enum', VOID, VOID, [Comparable]);
@@ -110,7 +110,7 @@ initMetadataForInterface(AutoCloseable, 'AutoCloseable');
110
110
  initMetadataForInterface(Comparator, 'Comparator');
111
111
  initMetadataForObject(Unit, 'Unit');
112
112
  initMetadataForClass(AbstractCollection, 'AbstractCollection', VOID, VOID, [Collection]);
113
- initMetadataForClass(AbstractMutableCollection, 'AbstractMutableCollection', VOID, AbstractCollection, [AbstractCollection, Collection, MutableIterable]);
113
+ initMetadataForClass(AbstractMutableCollection, 'AbstractMutableCollection', VOID, AbstractCollection, [AbstractCollection, MutableIterable, Collection]);
114
114
  initMetadataForClass(IteratorImpl, 'IteratorImpl');
115
115
  initMetadataForClass(ListIteratorImpl, 'ListIteratorImpl', VOID, IteratorImpl);
116
116
  initMetadataForClass(AbstractMutableList, 'AbstractMutableList', VOID, AbstractMutableCollection, [AbstractMutableCollection, KtMutableList]);
@@ -123,7 +123,7 @@ initMetadataForCompanion(Companion_2);
123
123
  initMetadataForClass(ArrayList, 'ArrayList', ArrayList_init_$Create$, AbstractMutableList, [AbstractMutableList, KtMutableList, RandomAccess]);
124
124
  initMetadataForClass(HashMap, 'HashMap', HashMap_init_$Create$, AbstractMutableMap, [AbstractMutableMap, KtMutableMap]);
125
125
  initMetadataForClass(HashMapKeys, 'HashMapKeys', VOID, AbstractMutableSet, [KtMutableSet, AbstractMutableSet]);
126
- initMetadataForClass(HashMapValues, 'HashMapValues', VOID, AbstractMutableCollection, [Collection, MutableIterable, AbstractMutableCollection]);
126
+ initMetadataForClass(HashMapValues, 'HashMapValues', VOID, AbstractMutableCollection, [MutableIterable, Collection, AbstractMutableCollection]);
127
127
  initMetadataForClass(HashMapEntrySetBase, 'HashMapEntrySetBase', VOID, AbstractMutableSet, [KtMutableSet, AbstractMutableSet]);
128
128
  initMetadataForClass(HashMapEntrySet, 'HashMapEntrySet', VOID, HashMapEntrySetBase);
129
129
  initMetadataForClass(HashMapKeysDefault$iterator$1);
@@ -10166,10 +10166,10 @@ function _init_properties_Semaphore_kt__t514r6() {
10166
10166
  }
10167
10167
  function createDefaultDispatcher() {
10168
10168
  var tmp;
10169
- if (isJsdom() || (typeof navigator !== 'undefined' && navigator !== null && navigator.product === "ReactNative")) {
10170
- if (schedule_queue_patch == undefined) {
10171
- schedule_queue_patch = process.nextTick ?? setImmediate
10172
- }
10169
+ if (schedule_queue_patch == undefined) {
10170
+ schedule_queue_patch = process.nextTick ?? setImmediate
10171
+ }
10172
+ if (isJsdom() || (typeof navigator !== 'undefined' && navigator !== null && navigator.product === "ReactNative")) {
10173
10173
 
10174
10174
  tmp = NodeDispatcher_getInstance();
10175
10175
  } else {
@@ -6,6 +6,7 @@ import { ParticipantType } from './base/ParticipantType.mjs';
6
6
  import { StoredDocument } from './base/StoredDocument.mjs';
7
7
  import { Address, DecryptedAddress, EncryptedAddress } from './embed/Address.mjs';
8
8
  import { Annotation } from './embed/Annotation.mjs';
9
+ import { ContactParticipant } from './embed/ContactParticipant.mjs';
9
10
  import { Delegation } from './embed/Delegation.mjs';
10
11
  import { Encryptable } from './embed/Encryptable.mjs';
11
12
  import { SecurityMetadata } from './embed/SecurityMetadata.mjs';
@@ -27,6 +28,7 @@ export interface Contact extends StoredDocument, ICureDocument<string>, HasEncry
27
28
  participants: {
28
29
  [key in ParticipantType]?: string;
29
30
  };
31
+ participantList: Array<ContactParticipant>;
30
32
  healthcarePartyId: string | undefined;
31
33
  modifiedContactId: string | undefined;
32
34
  notes: Array<Annotation>;
@@ -59,6 +61,7 @@ export declare class DecryptedContact {
59
61
  participants: {
60
62
  [key in ParticipantType]?: string;
61
63
  };
64
+ participantList: Array<ContactParticipant>;
62
65
  healthcarePartyId: string | undefined;
63
66
  modifiedContactId: string | undefined;
64
67
  secretForeignKeys: Array<string>;
@@ -105,6 +108,7 @@ export declare class EncryptedContact {
105
108
  participants: {
106
109
  [key in ParticipantType]?: string;
107
110
  };
111
+ participantList: Array<ContactParticipant>;
108
112
  healthcarePartyId: string | undefined;
109
113
  modifiedContactId: string | undefined;
110
114
  secretForeignKeys: Array<string>;
package/model/Contact.mjs CHANGED
@@ -6,6 +6,7 @@ import { Identifier } from './base/Identifier.mjs';
6
6
  import { ParticipantType } from './base/ParticipantType.mjs';
7
7
  import { DecryptedAddress, EncryptedAddress } from './embed/Address.mjs';
8
8
  import { Annotation } from './embed/Annotation.mjs';
9
+ import { ContactParticipant } from './embed/ContactParticipant.mjs';
9
10
  import { Delegation } from './embed/Delegation.mjs';
10
11
  import { SecurityMetadata } from './embed/SecurityMetadata.mjs';
11
12
  import { DecryptedService, EncryptedService } from './embed/Service.mjs';
@@ -35,6 +36,7 @@ export class DecryptedContact {
35
36
  this.subContacts = [];
36
37
  this.services = [];
37
38
  this.participants = {};
39
+ this.participantList = [];
38
40
  this.healthcarePartyId = undefined;
39
41
  this.modifiedContactId = undefined;
40
42
  this.secretForeignKeys = [];
@@ -92,6 +94,8 @@ export class DecryptedContact {
92
94
  this.services = partial.services;
93
95
  if ('participants' in partial && partial.participants !== undefined)
94
96
  this.participants = partial.participants;
97
+ if ('participantList' in partial && partial.participantList !== undefined)
98
+ this.participantList = partial.participantList;
95
99
  if ('healthcarePartyId' in partial)
96
100
  this.healthcarePartyId = partial.healthcarePartyId;
97
101
  if ('modifiedContactId' in partial)
@@ -152,6 +156,7 @@ export class DecryptedContact {
152
156
  res['subContacts'] = this.subContacts.map((x0) => x0.toJSON());
153
157
  res['services'] = this.services.map((x0) => x0.toJSON());
154
158
  res['participants'] = Object.fromEntries(Object.entries(this.participants).map(([k0, v0]) => [k0, v0]));
159
+ res['participantList'] = this.participantList.map((x0) => x0.toJSON());
155
160
  if (this.healthcarePartyId != undefined)
156
161
  res['healthcarePartyId'] = this.healthcarePartyId;
157
162
  if (this.modifiedContactId != undefined)
@@ -198,6 +203,7 @@ export class DecryptedContact {
198
203
  subContacts: expectArray(extractEntry(jCpy, 'subContacts', false, path), false, [...path, ".subContacts"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedSubContact.fromJSON)),
199
204
  services: expectArray(extractEntry(jCpy, 'services', false, path), false, [...path, ".services"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedService.fromJSON)),
200
205
  participants: expectMap(extractEntry(jCpy, 'participants', false, path), false, [...path, ".participants"], (k0, p0) => expectStringEnum(k0, false, p0, ParticipantType, 'ParticipantType'), (v0, p0) => expectString(v0, false, p0)),
206
+ participantList: expectArray(extractEntry(jCpy, 'participantList', false, path), false, [...path, ".participantList"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, ContactParticipant.fromJSON)),
201
207
  healthcarePartyId: expectString(extractEntry(jCpy, 'healthcarePartyId', false, path), true, [...path, ".healthcarePartyId"]),
202
208
  modifiedContactId: expectString(extractEntry(jCpy, 'modifiedContactId', false, path), true, [...path, ".modifiedContactId"]),
203
209
  secretForeignKeys: expectArray(extractEntry(jCpy, 'secretForeignKeys', false, path), false, [...path, ".secretForeignKeys"], (x0, p0) => expectString(x0, false, p0)),
@@ -241,6 +247,7 @@ export class EncryptedContact {
241
247
  this.subContacts = [];
242
248
  this.services = [];
243
249
  this.participants = {};
250
+ this.participantList = [];
244
251
  this.healthcarePartyId = undefined;
245
252
  this.modifiedContactId = undefined;
246
253
  this.secretForeignKeys = [];
@@ -298,6 +305,8 @@ export class EncryptedContact {
298
305
  this.services = partial.services;
299
306
  if ('participants' in partial && partial.participants !== undefined)
300
307
  this.participants = partial.participants;
308
+ if ('participantList' in partial && partial.participantList !== undefined)
309
+ this.participantList = partial.participantList;
301
310
  if ('healthcarePartyId' in partial)
302
311
  this.healthcarePartyId = partial.healthcarePartyId;
303
312
  if ('modifiedContactId' in partial)
@@ -358,6 +367,7 @@ export class EncryptedContact {
358
367
  res['subContacts'] = this.subContacts.map((x0) => x0.toJSON());
359
368
  res['services'] = this.services.map((x0) => x0.toJSON());
360
369
  res['participants'] = Object.fromEntries(Object.entries(this.participants).map(([k0, v0]) => [k0, v0]));
370
+ res['participantList'] = this.participantList.map((x0) => x0.toJSON());
361
371
  if (this.healthcarePartyId != undefined)
362
372
  res['healthcarePartyId'] = this.healthcarePartyId;
363
373
  if (this.modifiedContactId != undefined)
@@ -404,6 +414,7 @@ export class EncryptedContact {
404
414
  subContacts: expectArray(extractEntry(jCpy, 'subContacts', false, path), false, [...path, ".subContacts"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedSubContact.fromJSON)),
405
415
  services: expectArray(extractEntry(jCpy, 'services', false, path), false, [...path, ".services"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedService.fromJSON)),
406
416
  participants: expectMap(extractEntry(jCpy, 'participants', false, path), false, [...path, ".participants"], (k0, p0) => expectStringEnum(k0, false, p0, ParticipantType, 'ParticipantType'), (v0, p0) => expectString(v0, false, p0)),
417
+ participantList: expectArray(extractEntry(jCpy, 'participantList', false, path), false, [...path, ".participantList"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, ContactParticipant.fromJSON)),
407
418
  healthcarePartyId: expectString(extractEntry(jCpy, 'healthcarePartyId', false, path), true, [...path, ".healthcarePartyId"]),
408
419
  modifiedContactId: expectString(extractEntry(jCpy, 'modifiedContactId', false, path), true, [...path, ".modifiedContactId"]),
409
420
  secretForeignKeys: expectArray(extractEntry(jCpy, 'secretForeignKeys', false, path), false, [...path, ".secretForeignKeys"], (x0, p0) => expectString(x0, false, p0)),
@@ -11,5 +11,6 @@ export declare enum ParticipantType {
11
11
  Participation = "Participation",
12
12
  Translator = "Translator",
13
13
  Emergency = "Emergency",
14
- Location = "Location"
14
+ Location = "Location",
15
+ Recorder = "Recorder"
15
16
  }
@@ -14,4 +14,5 @@ export var ParticipantType;
14
14
  ParticipantType["Translator"] = "Translator";
15
15
  ParticipantType["Emergency"] = "Emergency";
16
16
  ParticipantType["Location"] = "Location";
17
+ ParticipantType["Recorder"] = "Recorder";
17
18
  })(ParticipantType || (ParticipantType = {}));
@@ -0,0 +1,8 @@
1
+ import { ParticipantType } from '../base/ParticipantType.mjs';
2
+ export declare class ContactParticipant {
3
+ type: ParticipantType;
4
+ hcpId: string;
5
+ constructor(partial: Partial<ContactParticipant> & Pick<ContactParticipant, "type" | "hcpId">);
6
+ toJSON(): object;
7
+ static fromJSON(json: any, ignoreUnknownKeys?: boolean, path?: Array<string>): ContactParticipant;
8
+ }
@@ -0,0 +1,30 @@
1
+ // auto-generated file
2
+ import { expectString, expectStringEnum, extractEntry } from '../../internal/JsonDecodeUtils.mjs';
3
+ import { ParticipantType } from '../base/ParticipantType.mjs';
4
+ export class ContactParticipant {
5
+ constructor(partial) {
6
+ this.type = partial.type;
7
+ this.hcpId = partial.hcpId;
8
+ }
9
+ toJSON() {
10
+ const res = {};
11
+ res['type'] = this.type;
12
+ res['hcpId'] = this.hcpId;
13
+ return res;
14
+ }
15
+ static fromJSON(json, ignoreUnknownKeys = false, path = ['ContactParticipant']) {
16
+ if (typeof json != 'object')
17
+ throw new Error(`Expected json object at path ${path.join("")}`);
18
+ const jCpy = Object.assign({}, json);
19
+ const res = new ContactParticipant({
20
+ type: expectStringEnum(extractEntry(jCpy, 'type', true, path), false, [...path, ".type"], ParticipantType, 'ParticipantType'),
21
+ hcpId: expectString(extractEntry(jCpy, 'hcpId', true, path), false, [...path, ".hcpId"]),
22
+ });
23
+ if (!ignoreUnknownKeys) {
24
+ const unused = Object.keys(jCpy);
25
+ if (unused.length > 0)
26
+ throw new Error(`Unexpected key(s) for json object ContactParticipant at path ${path.join("")}: ${unused}`);
27
+ }
28
+ return res;
29
+ }
30
+ }
@@ -11,6 +11,7 @@ export declare namespace ExternalJwtConfig {
11
11
  namespace ValidationMethod {
12
12
  class PublicKey {
13
13
  key: string;
14
+ signatureAlgorithm: string | undefined;
14
15
  readonly $ktClass: 'com.icure.cardinal.sdk.model.security.ExternalJwtConfig.ValidationMethod.PublicKey';
15
16
  constructor(partial: Partial<PublicKey> & Pick<PublicKey, "key">);
16
17
  toJSON(): object;
@@ -38,12 +38,17 @@ export class ExternalJwtConfig {
38
38
  (function (ValidationMethod) {
39
39
  class PublicKey {
40
40
  constructor(partial) {
41
+ this.signatureAlgorithm = undefined;
41
42
  this.$ktClass = 'com.icure.cardinal.sdk.model.security.ExternalJwtConfig.ValidationMethod.PublicKey';
42
43
  this.key = partial.key;
44
+ if ('signatureAlgorithm' in partial)
45
+ this.signatureAlgorithm = partial.signatureAlgorithm;
43
46
  }
44
47
  toJSON() {
45
48
  const res = {};
46
49
  res['key'] = this.key;
50
+ if (this.signatureAlgorithm != undefined)
51
+ res['signatureAlgorithm'] = this.signatureAlgorithm;
47
52
  res['$ktClass'] = 'com.icure.cardinal.sdk.model.security.ExternalJwtConfig.ValidationMethod.PublicKey';
48
53
  return res;
49
54
  }
@@ -55,6 +60,7 @@ export class ExternalJwtConfig {
55
60
  throw new Error(`Unexpected value for ${path.join("")} class marker, should be "com.icure.cardinal.sdk.model.security.ExternalJwtConfig.ValidationMethod.PublicKey". The provided json doesn't represent a PublicKey`);
56
61
  const res = new PublicKey({
57
62
  key: expectString(extractEntry(jCpy, 'key', true, path), false, [...path, ".key"]),
63
+ signatureAlgorithm: expectString(extractEntry(jCpy, 'signatureAlgorithm', false, path), true, [...path, ".signatureAlgorithm"]),
58
64
  });
59
65
  if (!ignoreUnknownKeys) {
60
66
  const unused = Object.keys(jCpy);
package/model.d.mts CHANGED
@@ -133,6 +133,7 @@ export * from './model/embed/Delegation.mjs';
133
133
  export * from './model/embed/PersonalStatus.mjs';
134
134
  export * from './model/embed/RegimenItem.mjs';
135
135
  export * from './model/embed/DocumentGroup.mjs';
136
+ export * from './model/embed/ContactParticipant.mjs';
136
137
  export * from './model/embed/DataAttachment.mjs';
137
138
  export * from './model/embed/DeletedAttachment.mjs';
138
139
  export * from './model/embed/Weekday.mjs';
package/model.mjs CHANGED
@@ -133,6 +133,7 @@ export * from './model/embed/Delegation.mjs';
133
133
  export * from './model/embed/PersonalStatus.mjs';
134
134
  export * from './model/embed/RegimenItem.mjs';
135
135
  export * from './model/embed/DocumentGroup.mjs';
136
+ export * from './model/embed/ContactParticipant.mjs';
136
137
  export * from './model/embed/DataAttachment.mjs';
137
138
  export * from './model/embed/DeletedAttachment.mjs';
138
139
  export * from './model/embed/Weekday.mjs';
@@ -1,8 +1,5 @@
1
1
  import { AuthenticationClass } from "../model/embed/AuthenticationClass.mjs";
2
2
  import { CaptchaOptions } from "../auth/CaptchaOptions.mjs";
3
- export declare enum ThirdPartyProvider {
4
- GOOGLE = "GOOGLE"
5
- }
6
3
  export declare namespace AuthenticationMethod {
7
4
  /**
8
5
  * The sdk will perform requests using jwt obtained from the provided credentials.
@@ -72,24 +69,38 @@ export declare namespace AuthenticationMethod {
72
69
  */
73
70
  token: string);
74
71
  }
75
- class ThirdPartyAuth {
72
+ class ExternalAuthenticationToken {
73
+ /**
74
+ * The id of the configuration that specifies how the token should be validated and how it should be used to find
75
+ * the corresponding user in iCure.
76
+ *
77
+ * Note you can only use external authentication if the sdk instance was initialized with an application id.
78
+ */
79
+ readonly configId: string;
76
80
  /**
77
- * A token used to perform the third party authentication
81
+ * A token used to perform the external authentication
78
82
  */
79
83
  readonly token: string;
80
84
  /**
81
- * The authentication provider
85
+ * During login consider only configurations that can provide at least this authentication class
82
86
  */
83
- readonly provider: ThirdPartyProvider;
87
+ readonly minimumAuthenticationClass?: AuthenticationClass | undefined;
84
88
  constructor(
85
89
  /**
86
- * A token used to perform the third party authentication
90
+ * The id of the configuration that specifies how the token should be validated and how it should be used to find
91
+ * the corresponding user in iCure.
92
+ *
93
+ * Note you can only use external authentication if the sdk instance was initialized with an application id.
94
+ */
95
+ configId: string,
96
+ /**
97
+ * A token used to perform the external authentication
87
98
  */
88
99
  token: string,
89
100
  /**
90
- * The authentication provider
101
+ * During login consider only configurations that can provide at least this authentication class
91
102
  */
92
- provider: ThirdPartyProvider);
103
+ minimumAuthenticationClass?: AuthenticationClass | undefined);
93
104
  }
94
105
  class JwtCredentials {
95
106
  /**
@@ -135,7 +146,7 @@ export declare namespace AuthenticationMethod {
135
146
  constructor(secretProvider: AuthSecretProvider, options?: SecretProviderAuthenticationOptions | undefined);
136
147
  }
137
148
  }
138
- export type AuthenticationMethod = AuthenticationMethod.UsingCredentials.UsernamePassword | AuthenticationMethod.UsingCredentials.UsernameLongToken | AuthenticationMethod.UsingCredentials.ThirdPartyAuth | AuthenticationMethod.UsingCredentials.JwtCredentials | AuthenticationMethod.UsingSecretProvider;
149
+ export type AuthenticationMethod = AuthenticationMethod.UsingCredentials.UsernamePassword | AuthenticationMethod.UsingCredentials.UsernameLongToken | AuthenticationMethod.UsingCredentials.ExternalAuthenticationToken | AuthenticationMethod.UsingCredentials.JwtCredentials | AuthenticationMethod.UsingSecretProvider;
139
150
  export interface SecretProviderAuthenticationOptions {
140
151
  /**
141
152
  * A public identifier of the user logging in. This could be:
@@ -179,13 +190,13 @@ export declare namespace SecretProviderAuthenticationOptions {
179
190
  readonly token: string;
180
191
  constructor(token: string);
181
192
  }
182
- class OAuth {
183
- readonly secret: string;
184
- readonly oauthType: ThirdPartyProvider;
185
- constructor(secret: string, oauthType: ThirdPartyProvider);
193
+ class ExternalAuthenticationToken {
194
+ readonly token: string;
195
+ readonly configId: string;
196
+ constructor(token: string, configId: string);
186
197
  }
187
198
  }
188
- type InitialSecret = InitialSecret.Password | InitialSecret.LongLivedToken | InitialSecret.OAuth;
199
+ type InitialSecret = InitialSecret.Password | InitialSecret.LongLivedToken | InitialSecret.ExternalAuthenticationToken;
189
200
  }
190
201
  export interface AuthSecretProvider {
191
202
  /**
@@ -258,24 +269,26 @@ export declare namespace AuthSecretDetails {
258
269
  */
259
270
  constructor(secret: String);
260
271
  }
261
- class ExternalAuthenticationDetails {
262
- readonly secret: String;
263
- readonly oauthType: ThirdPartyProvider;
264
- /**
265
- * @param secret some token or another secret that can be used to authenticate the user to a supported third party service
266
- * @param oauthType the third party service that should recognize the provided secret.
267
- */
268
- constructor(secret: String, oauthType: ThirdPartyProvider);
269
- }
270
- class DigitalIdDetails {
271
- readonly secret: String;
272
+ class ConfiguredExternalAuthenticationDetails {
273
+ readonly configId: string;
274
+ readonly secret: string;
275
+ readonly minimumAuthenticationClass?: AuthenticationClass | undefined;
272
276
  /**
273
- * Not yet implemented
277
+ * Login using a token or other secret provided by another authentication service configured for your project.
278
+ *
279
+ * This AuthSecretDetails type can only be used if the sdk initialization provided an application id: using
280
+ * this AuthSecretDetails with an instance of SDK that doesn't have a configured application id will result in a
281
+ * runtime exception.
282
+ *
283
+ * @param configId id of the configuration to use for authentication.
284
+ * @param secret the token or another secret that will be used for authentication.
285
+ * @param minimumAuthenticationClass only consider configurations that can provide at least this authentication class. The actual
286
+ * authentication class obtained for the token may be higher.
274
287
  */
275
- constructor(secret: String);
288
+ constructor(configId: string, secret: string, minimumAuthenticationClass?: AuthenticationClass | undefined);
276
289
  }
277
290
  }
278
- export type AuthSecretDetails = AuthSecretDetails.PasswordDetails | AuthSecretDetails.TwoFactorAuthTokenDetails | AuthSecretDetails.ShortLivedTokenDetails | AuthSecretDetails.LongLivedTokenDetails | AuthSecretDetails.ExternalAuthenticationDetails | AuthSecretDetails.DigitalIdDetails;
291
+ export type AuthSecretDetails = AuthSecretDetails.PasswordDetails | AuthSecretDetails.TwoFactorAuthTokenDetails | AuthSecretDetails.ShortLivedTokenDetails | AuthSecretDetails.LongLivedTokenDetails | AuthSecretDetails.ConfiguredExternalAuthenticationDetails;
279
292
  /**
280
293
  * Allows initializing processes for the registration and authentication of users.
281
294
  */
@@ -1,7 +1,3 @@
1
- export var ThirdPartyProvider;
2
- (function (ThirdPartyProvider) {
3
- ThirdPartyProvider["GOOGLE"] = "GOOGLE";
4
- })(ThirdPartyProvider || (ThirdPartyProvider = {}));
5
1
  export var AuthenticationMethod;
6
2
  (function (AuthenticationMethod) {
7
3
  /**
@@ -57,21 +53,29 @@ export var AuthenticationMethod;
57
53
  }
58
54
  }
59
55
  UsingCredentials.UsernameLongToken = UsernameLongToken;
60
- class ThirdPartyAuth {
56
+ class ExternalAuthenticationToken {
61
57
  constructor(
62
58
  /**
63
- * A token used to perform the third party authentication
59
+ * The id of the configuration that specifies how the token should be validated and how it should be used to find
60
+ * the corresponding user in iCure.
61
+ *
62
+ * Note you can only use external authentication if the sdk instance was initialized with an application id.
63
+ */
64
+ configId,
65
+ /**
66
+ * A token used to perform the external authentication
64
67
  */
65
68
  token,
66
69
  /**
67
- * The authentication provider
70
+ * During login consider only configurations that can provide at least this authentication class
68
71
  */
69
- provider) {
72
+ minimumAuthenticationClass) {
73
+ this.configId = configId;
70
74
  this.token = token;
71
- this.provider = provider;
75
+ this.minimumAuthenticationClass = minimumAuthenticationClass;
72
76
  }
73
77
  }
74
- UsingCredentials.ThirdPartyAuth = ThirdPartyAuth;
78
+ UsingCredentials.ExternalAuthenticationToken = ExternalAuthenticationToken;
75
79
  class JwtCredentials {
76
80
  constructor(
77
81
  /**
@@ -130,13 +134,13 @@ export var SecretProviderAuthenticationOptions;
130
134
  }
131
135
  }
132
136
  InitialSecret.LongLivedToken = LongLivedToken;
133
- class OAuth {
134
- constructor(secret, oauthType) {
135
- this.secret = secret;
136
- this.oauthType = oauthType;
137
+ class ExternalAuthenticationToken {
138
+ constructor(token, configId) {
139
+ this.token = token;
140
+ this.configId = configId;
137
141
  }
138
142
  }
139
- InitialSecret.OAuth = OAuth;
143
+ InitialSecret.ExternalAuthenticationToken = ExternalAuthenticationToken;
140
144
  })(InitialSecret = SecretProviderAuthenticationOptions.InitialSecret || (SecretProviderAuthenticationOptions.InitialSecret = {}));
141
145
  })(SecretProviderAuthenticationOptions || (SecretProviderAuthenticationOptions = {}));
142
146
  export var AuthSecretDetails;
@@ -179,26 +183,26 @@ export var AuthSecretDetails;
179
183
  }
180
184
  }
181
185
  AuthSecretDetails.LongLivedTokenDetails = LongLivedTokenDetails;
182
- class ExternalAuthenticationDetails {
186
+ class ConfiguredExternalAuthenticationDetails {
183
187
  /**
184
- * @param secret some token or another secret that can be used to authenticate the user to a supported third party service
185
- * @param oauthType the third party service that should recognize the provided secret.
188
+ * Login using a token or other secret provided by another authentication service configured for your project.
189
+ *
190
+ * This AuthSecretDetails type can only be used if the sdk initialization provided an application id: using
191
+ * this AuthSecretDetails with an instance of SDK that doesn't have a configured application id will result in a
192
+ * runtime exception.
193
+ *
194
+ * @param configId id of the configuration to use for authentication.
195
+ * @param secret the token or another secret that will be used for authentication.
196
+ * @param minimumAuthenticationClass only consider configurations that can provide at least this authentication class. The actual
197
+ * authentication class obtained for the token may be higher.
186
198
  */
187
- constructor(secret, oauthType) {
188
- this.secret = secret;
189
- this.oauthType = oauthType;
190
- }
191
- }
192
- AuthSecretDetails.ExternalAuthenticationDetails = ExternalAuthenticationDetails;
193
- class DigitalIdDetails {
194
- /**
195
- * Not yet implemented
196
- */
197
- constructor(secret) {
199
+ constructor(configId, secret, minimumAuthenticationClass) {
200
+ this.configId = configId;
198
201
  this.secret = secret;
202
+ this.minimumAuthenticationClass = minimumAuthenticationClass;
199
203
  }
200
204
  }
201
- AuthSecretDetails.DigitalIdDetails = DigitalIdDetails;
205
+ AuthSecretDetails.ConfiguredExternalAuthenticationDetails = ConfiguredExternalAuthenticationDetails;
202
206
  })(AuthSecretDetails || (AuthSecretDetails = {}));
203
207
  export var AuthenticationProcessTelecomType;
204
208
  (function (AuthenticationProcessTelecomType) {
@@ -102,6 +102,35 @@ export interface BasicSdkOptions {
102
102
  */
103
103
  readonly lenientJson?: boolean;
104
104
  }
105
+ /**
106
+ * Optional parameters used in the conversion from a basic sdk to a full sdk.
107
+ */
108
+ export interface BasicToFullSdkOptions {
109
+ /**
110
+ * Refer to {@link SdkOptions.useHierarchicalDataOwners }
111
+ */
112
+ readonly useHierarchicalDataOwners?: boolean;
113
+ /**
114
+ * Refer to {@link SdkOptions.createTransferKeys }
115
+ */
116
+ readonly createTransferKeys?: boolean;
117
+ /**
118
+ * Refer to {@link SdkOptions.autoCreateEncryptionKeyForExistingLegacyData }
119
+ */
120
+ readonly autoCreateEncryptionKeyForExistingLegacyData?: boolean;
121
+ /**
122
+ * Refer to {@link SdkOptions.keyStorage }
123
+ */
124
+ readonly keyStorage?: KeyStorageFacade | CardinalKeyStorageOptions;
125
+ /**
126
+ * Refer to {@link SdkOptions.cryptoStrategies }
127
+ */
128
+ readonly cryptoStrategies?: CryptoStrategies;
129
+ /**
130
+ * Refer to {@link SdkOptions.jsonPatcher }
131
+ */
132
+ readonly jsonPatcher?: JsonPatcher;
133
+ }
105
134
  export interface AnonymousSdkOptions {
106
135
  /**
107
136
  * If true the SDK will use lenient deserialization of the entities coming from the backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/cardinal-sdk",
3
- "version": "2.0.0-PREVIEW-21",
3
+ "version": "2.0.0-PREVIEW-23",
4
4
  "main": "cardinal-sdk-ts.mjs",
5
5
  "types": "cardinal-sdk-ts.d.mts",
6
6
  "devDependencies": {
@@ -22,7 +22,7 @@ import { RecoveryApi } from "../api/RecoveryApi.mjs";
22
22
  import { AuthenticationMethod, AuthenticationProcessTelecomType, AuthenticationProcessTemplateParameters } from "../options/AuthenticationMethod.mjs";
23
23
  import { StorageFacade } from "../storage/StorageFacade.mjs";
24
24
  import { CardinalStorageOptions } from "../cardinal-sdk-ts.mjs";
25
- import { SdkOptions, BasicSdkOptions, AnonymousSdkOptions } from "../options/SdkOptions.mjs";
25
+ import { SdkOptions, BasicSdkOptions, AnonymousSdkOptions, BasicToFullSdkOptions } from "../options/SdkOptions.mjs";
26
26
  import { ApplicationSettingsApi } from "../api/ApplicationSettingsApi.mjs";
27
27
  import { CodeApi } from "../api/CodeApi.mjs";
28
28
  import { DocumentTemplateApi } from "../api/DocumentTemplateApi.mjs";
@@ -174,6 +174,14 @@ export interface CardinalBaseSdk extends CardinalBaseApis {
174
174
  * @return a new sdk for executing requests in the provided group
175
175
  */
176
176
  switchGroup(groupId: string): Promise<CardinalBaseSdk>;
177
+ /**
178
+ * Use the authentication for this base sdk to create a full sdk for the same user. Can only be used if the
179
+ * current user is a data owner.
180
+ * @param baseStorage an implementation of the [StorageFacade], used for persistent storage of various
181
+ * information including the user keys if [BasicToFullSdkOptions.keyStorage] is not provided.
182
+ * @param options additional options for the creation of the full sdk
183
+ */
184
+ toFullSdk(baseStorage: StorageFacade | CardinalStorageOptions, options?: BasicToFullSdkOptions): Promise<CardinalSdk>;
177
185
  }
178
186
  export declare namespace CardinalSdk {
179
187
  /**
@@ -230,6 +238,36 @@ export declare namespace CardinalBaseSdk {
230
238
  * @param options optional parameters for the initialization of the sdk.
231
239
  */
232
240
  function initialize(applicationId: string | undefined, baseUrl: string, authenticationMethod: AuthenticationMethod, options?: BasicSdkOptions): Promise<CardinalBaseSdk>;
241
+ /**
242
+ * Initialize a new instance of the icure base sdk for a specific user.
243
+ * The authentication will be performed through an authentication process.
244
+ *
245
+ * @param applicationId a string to uniquely identify your iCure application.
246
+ * @param baseUrl the url of the iCure backend to use
247
+ * @param messageGatewayUrl the url of the iCure message gateway you want to use. Usually this should be
248
+ * @param externalServicesSpecId an identifier that allows the message gateway to connect the request to your
249
+ * services for email / sms communication of the process tokens.
250
+ * @param processId the id of the process you want to execute.
251
+ * @param userTelecomType the type of telecom number used for the user.
252
+ * @param userTelecom the telecom number of the user for which you want to execute the process. This should be an
253
+ * email address or phone number depending on the type of process you are executing.
254
+ * @param captchaOptions the captcha options
255
+ * @param authenticationProcessTemplateParameters optional parameters which may be used by sms/email templates.
256
+ * @param options optional parameters for the initialization of the sdk.
257
+ */
258
+ function initializeWithProcess(applicationId: string | undefined, baseUrl: string, messageGatewayUrl: string, externalServicesSpecId: string, processId: string, userTelecomType: AuthenticationProcessTelecomType, userTelecom: string, captchaOptions: CaptchaOptions, authenticationProcessTemplateParameters?: AuthenticationProcessTemplateParameters, options?: BasicSdkOptions): Promise<BaseAuthenticationWithProcessStep>;
259
+ /**
260
+ * Represents an intermediate stage in the initialization of a base SDK through an authentication process
261
+ * The initialization can complete only after the user provides the validation code received via email/sms.
262
+ */
263
+ interface BaseAuthenticationWithProcessStep {
264
+ /**
265
+ * Complete the authentication of the user and finishes the initialization of the SDK.
266
+ * In case the provided validation code is wrong this method will throw an exception, but it is still possible
267
+ * to call to re-attempt authentication by calling this method with a different validation code.
268
+ */
269
+ completeAuthentication(validationCode: String): Promise<CardinalBaseSdk>;
270
+ }
233
271
  }
234
272
  export interface CardinalAnonymousApis {
235
273
  readonly agenda: AnonymousAgendaApi;
@@ -68,6 +68,29 @@ export var CardinalBaseSdk;
68
68
  });
69
69
  }
70
70
  CardinalBaseSdk.initialize = initialize;
71
+ /**
72
+ * Initialize a new instance of the icure base sdk for a specific user.
73
+ * The authentication will be performed through an authentication process.
74
+ *
75
+ * @param applicationId a string to uniquely identify your iCure application.
76
+ * @param baseUrl the url of the iCure backend to use
77
+ * @param messageGatewayUrl the url of the iCure message gateway you want to use. Usually this should be
78
+ * @param externalServicesSpecId an identifier that allows the message gateway to connect the request to your
79
+ * services for email / sms communication of the process tokens.
80
+ * @param processId the id of the process you want to execute.
81
+ * @param userTelecomType the type of telecom number used for the user.
82
+ * @param userTelecom the telecom number of the user for which you want to execute the process. This should be an
83
+ * email address or phone number depending on the type of process you are executing.
84
+ * @param captchaOptions the captcha options
85
+ * @param authenticationProcessTemplateParameters optional parameters which may be used by sms/email templates.
86
+ * @param options optional parameters for the initialization of the sdk.
87
+ */
88
+ function initializeWithProcess(applicationId, baseUrl, messageGatewayUrl, externalServicesSpecId, processId, userTelecomType, userTelecom, captchaOptions, authenticationProcessTemplateParameters, options) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ return yield InternalSdkInitializers.getInstance().initializeWithProcessBase(applicationId, baseUrl, messageGatewayUrl, externalServicesSpecId, processId, userTelecomType, userTelecom, captchaOptions, authenticationProcessTemplateParameters, options);
91
+ });
92
+ }
93
+ CardinalBaseSdk.initializeWithProcess = initializeWithProcess;
71
94
  })(CardinalBaseSdk || (CardinalBaseSdk = {}));
72
95
  export var CardinalAnonymousSdk;
73
96
  (function (CardinalAnonymousSdk) {