@icure/api 8.0.78 → 8.1.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.
- package/icc-x-api/crypto/ExchangeKeysManager.d.ts +1 -0
- package/icc-x-api/crypto/ExchangeKeysManager.js +26 -16
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +47 -2
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +8 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +81 -2
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/SecretIdUseOption.d.ts +60 -0
- package/icc-x-api/crypto/SecretIdUseOption.js +60 -0
- package/icc-x-api/crypto/SecretIdUseOption.js.map +1 -0
- package/icc-x-api/icc-accesslog-x-api.d.ts +2 -1
- package/icc-x-api/icc-accesslog-x-api.js +2 -3
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +26 -3
- package/icc-x-api/icc-calendar-item-x-api.js +51 -16
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +2 -1
- package/icc-x-api/icc-classification-x-api.js +2 -3
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +3 -2
- package/icc-x-api/icc-contact-x-api.js +5 -8
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +1 -7
- package/icc-x-api/icc-crypto-x-api.js +1 -8
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +2 -1
- package/icc-x-api/icc-document-x-api.js +3 -6
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +2 -1
- package/icc-x-api/icc-form-x-api.js +2 -3
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +3 -2
- package/icc-x-api/icc-helement-x-api.js +5 -8
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +2 -1
- package/icc-x-api/icc-invoice-x-api.js +2 -3
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +2 -1
- package/icc-x-api/icc-message-x-api.js +2 -3
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +4 -6
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.d.ts +2 -1
- package/icc-x-api/icc-topic-x-api.js +3 -2
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/index.js +1 -3
- package/icc-x-api/index.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-x-api/confidential-entities-test.js +49 -6
- package/test/icc-x-api/confidential-entities-test.js.map +1 -1
- package/test/icc-x-api/crypto/cryptoTest.js +5 -3
- package/test/icc-x-api/crypto/cryptoTest.js.map +1 -1
- package/test/icc-x-api/crypto/full-crypto-test.js +0 -2
- package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -1
- package/test/icc-x-api/crypto/shamir.js +3 -1
- package/test/icc-x-api/crypto/shamir.js.map +1 -1
- package/test/icc-x-api/diocancaro.d.ts +1 -0
- package/test/icc-x-api/diocancaro.js +75 -0
- package/test/icc-x-api/diocancaro.js.map +1 -0
- package/test/icc-x-api/icc-calendar-item-x-api.js +1 -1
- package/test/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/test/icc-x-api/icc-contact-x-api.js +4 -2
- package/test/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/test/icc-x-api/icc-helement-x-api-test.js +3 -1
- package/test/icc-x-api/icc-helement-x-api-test.js.map +1 -1
- package/icc-x-api/crypto/ConfidentialEntities.d.ts +0 -64
- package/icc-x-api/crypto/ConfidentialEntities.js +0 -112
- package/icc-x-api/crypto/ConfidentialEntities.js.map +0 -1
|
@@ -6,7 +6,6 @@ import { UserEncryptionKeysManager } from './crypto/UserEncryptionKeysManager';
|
|
|
6
6
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
7
7
|
import { ExtendedApisUtils } from './crypto/ExtendedApisUtils';
|
|
8
8
|
import { ShamirKeysManager } from './crypto/ShamirKeysManager';
|
|
9
|
-
import { ConfidentialEntities } from './crypto/ConfidentialEntities';
|
|
10
9
|
import { ExchangeDataManager } from './crypto/ExchangeDataManager';
|
|
11
10
|
import { AccessControlKeysHeadersProvider } from './crypto/AccessControlKeysHeadersProvider';
|
|
12
11
|
import { KeyPair } from './crypto/RSA';
|
|
@@ -20,7 +19,6 @@ export declare class IccCryptoXApi {
|
|
|
20
19
|
private readonly _shamirManager;
|
|
21
20
|
private readonly _storage;
|
|
22
21
|
private readonly _keyStorage;
|
|
23
|
-
private readonly _confidentialEntities;
|
|
24
22
|
private readonly _exchangeDataManager;
|
|
25
23
|
private readonly _accessControlKeysHeaders;
|
|
26
24
|
private readonly _delegationsDeAnonymisation;
|
|
@@ -48,10 +46,6 @@ export declare class IccCryptoXApi {
|
|
|
48
46
|
* @internal this is for internal use only and may be changed without notice.
|
|
49
47
|
*/
|
|
50
48
|
get exchangeData(): ExchangeDataManager;
|
|
51
|
-
/**
|
|
52
|
-
* @internal this is for internal use only and may be changed without notice.
|
|
53
|
-
*/
|
|
54
|
-
get confidential(): ConfidentialEntities;
|
|
55
49
|
/**
|
|
56
50
|
* @internal this is for internal use only and may be changed without notice.
|
|
57
51
|
*/
|
|
@@ -71,7 +65,7 @@ export declare class IccCryptoXApi {
|
|
|
71
65
|
/**
|
|
72
66
|
* @internal
|
|
73
67
|
*/
|
|
74
|
-
constructor(_exchangeKeysManager: ExchangeKeysManager, _cryptoPrimitives: CryptoPrimitives, _keyManager: UserEncryptionKeysManager, _dataOwnerApi: IccDataOwnerXApi, xapiUtils: ExtendedApisUtils, _shamirManager: ShamirKeysManager, _storage: StorageFacade<string>, _keyStorage: KeyStorageFacade,
|
|
68
|
+
constructor(_exchangeKeysManager: ExchangeKeysManager, _cryptoPrimitives: CryptoPrimitives, _keyManager: UserEncryptionKeysManager, _dataOwnerApi: IccDataOwnerXApi, xapiUtils: ExtendedApisUtils, _shamirManager: ShamirKeysManager, _storage: StorageFacade<string>, _keyStorage: KeyStorageFacade, _exchangeDataManager: ExchangeDataManager, _accessControlKeysHeaders: AccessControlKeysHeadersProvider, _delegationsDeAnonymisation: DelegationsDeAnonymization);
|
|
75
69
|
/**
|
|
76
70
|
* Deletes values cached by the crypto api, to allow to detect changes in stored key pairs, exchange keys and/or current data owner details.
|
|
77
71
|
* This method may be useful in cases where a user is logged in from multiple devices or in cases where other users have just shared some data with
|
|
@@ -47,12 +47,6 @@ class IccCryptoXApi {
|
|
|
47
47
|
get exchangeData() {
|
|
48
48
|
return this._exchangeDataManager;
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* @internal this is for internal use only and may be changed without notice.
|
|
52
|
-
*/
|
|
53
|
-
get confidential() {
|
|
54
|
-
return this._confidentialEntities;
|
|
55
|
-
}
|
|
56
50
|
/**
|
|
57
51
|
* @internal this is for internal use only and may be changed without notice.
|
|
58
52
|
*/
|
|
@@ -80,7 +74,7 @@ class IccCryptoXApi {
|
|
|
80
74
|
/**
|
|
81
75
|
* @internal
|
|
82
76
|
*/
|
|
83
|
-
constructor(_exchangeKeysManager, _cryptoPrimitives, _keyManager, _dataOwnerApi, xapiUtils, _shamirManager, _storage, _keyStorage,
|
|
77
|
+
constructor(_exchangeKeysManager, _cryptoPrimitives, _keyManager, _dataOwnerApi, xapiUtils, _shamirManager, _storage, _keyStorage, _exchangeDataManager, _accessControlKeysHeaders, _delegationsDeAnonymisation) {
|
|
84
78
|
this._exchangeKeysManager = _exchangeKeysManager;
|
|
85
79
|
this._cryptoPrimitives = _cryptoPrimitives;
|
|
86
80
|
this._keyManager = _keyManager;
|
|
@@ -89,7 +83,6 @@ class IccCryptoXApi {
|
|
|
89
83
|
this._shamirManager = _shamirManager;
|
|
90
84
|
this._storage = _storage;
|
|
91
85
|
this._keyStorage = _keyStorage;
|
|
92
|
-
this._confidentialEntities = _confidentialEntities;
|
|
93
86
|
this._exchangeDataManager = _exchangeDataManager;
|
|
94
87
|
this._accessControlKeysHeaders = _accessControlKeysHeaders;
|
|
95
88
|
this._delegationsDeAnonymisation = _delegationsDeAnonymisation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-crypto-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-crypto-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"icc-crypto-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-crypto-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAaA,MAAa,aAAa;IACxB;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,iBAAiB,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,wBAAwB;QAC1B,OAAO,IAAI,CAAC,yBAAyB,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,0BAA0B;QAC5B,OAAO,IAAI,CAAC,2BAA2B,CAAA;IACzC,CAAC;IAED;;OAEG;IACH,YACmB,oBAAyC,EACzC,iBAAmC,EACnC,WAAsC,EACtC,aAA+B,EAC/B,SAA4B,EAC5B,cAAiC,EACjC,QAA+B,EAC/B,WAA6B,EAC7B,oBAAyC,EACzC,yBAA2D,EAC3D,2BAAuD;QAVvD,yBAAoB,GAApB,oBAAoB,CAAqB;QACzC,sBAAiB,GAAjB,iBAAiB,CAAkB;QACnC,gBAAW,GAAX,WAAW,CAA2B;QACtC,kBAAa,GAAb,aAAa,CAAkB;QAC/B,cAAS,GAAT,SAAS,CAAmB;QAC5B,mBAAc,GAAd,cAAc,CAAmB;QACjC,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,gBAAW,GAAX,WAAW,CAAkB;QAC7B,yBAAoB,GAApB,oBAAoB,CAAqB;QACzC,8BAAyB,GAAzB,yBAAyB,CAAkC;QAC3D,gCAA2B,GAA3B,2BAA2B,CAA4B;IACvE,CAAC;IAEJ;;;;OAIG;IACG,WAAW;;YACf,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,CAAA;YAC7C,IAAI,CAAC,aAAa,CAAC,6BAA6B,EAAE,CAAA;YAClD,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAA;YACnC,MAAM,IAAI,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,CAAA;QAC1D,CAAC;KAAA;IAED;;;;;;;OAOG;IACH,oDAAoD;QAUlD,OAAO,IAAI,CAAC,WAAW,CAAC,wCAAwC,EAAE,CAAA;IACpE,CAAC;IAED;;;;OAIG;IACH,wBAAwB,CAAC,WAAmB;QAC1C,OAAO,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAA;IAC/D,CAAC;IAED;;;;;OAKG;IACG,6CAA6C;;YACjD,OAAO,IAAI,CAAC,WAAW,CAAC,6CAA6C,EAAE,CAAA;QACzE,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,oCAAoC,CAAC,YAAqB;;YAC9D,OAAO,IAAI,CAAC,WAAW,CAAC,oCAAoC,CAAC,YAAY,CAAC,CAAA;QAC5E,CAAC;KAAA;CACF;AAvJD,sCAuJC","sourcesContent":["import { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { ExchangeKeysManager } from './crypto/ExchangeKeysManager'\nimport { CryptoPrimitives } from './crypto/CryptoPrimitives'\nimport { UserEncryptionKeysManager } from './crypto/UserEncryptionKeysManager'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { ExtendedApisUtils } from './crypto/ExtendedApisUtils'\nimport { ShamirKeysManager } from './crypto/ShamirKeysManager'\nimport { ExchangeDataManager } from './crypto/ExchangeDataManager'\nimport { AccessControlKeysHeadersProvider } from './crypto/AccessControlKeysHeadersProvider'\nimport { KeyPair } from './crypto/RSA'\nimport { DelegationsDeAnonymization } from './crypto/DelegationsDeAnonymization'\n\nexport class IccCryptoXApi {\n /**\n * The instance of {@link CryptoPrimitives} used by this instance of the iCure SDK.\n */\n get primitives(): CryptoPrimitives {\n return this._cryptoPrimitives\n }\n\n /**\n * @internal this method is for internal use only and may be changed without notice.\n */\n get exchangeKeys(): ExchangeKeysManager {\n return this._exchangeKeysManager\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get keyStorage(): KeyStorageFacade {\n return this._keyStorage\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get storage(): StorageFacade<string> {\n return this._storage\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get xapi(): ExtendedApisUtils {\n return this.xapiUtils\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get exchangeData(): ExchangeDataManager {\n return this._exchangeDataManager\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get accessControlKeysHeaders(): AccessControlKeysHeadersProvider {\n return this._accessControlKeysHeaders\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get userKeysManager(): UserEncryptionKeysManager {\n return this._keyManager\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get shamirKeysManager(): ShamirKeysManager {\n return this._shamirManager\n }\n\n /**\n * @internal this is for internal use only and may be changed without notice.\n */\n get delegationsDeAnonymization(): DelegationsDeAnonymization {\n return this._delegationsDeAnonymisation\n }\n\n /**\n * @internal\n */\n constructor(\n private readonly _exchangeKeysManager: ExchangeKeysManager,\n private readonly _cryptoPrimitives: CryptoPrimitives,\n private readonly _keyManager: UserEncryptionKeysManager,\n private readonly _dataOwnerApi: IccDataOwnerXApi,\n private readonly xapiUtils: ExtendedApisUtils,\n private readonly _shamirManager: ShamirKeysManager,\n private readonly _storage: StorageFacade<string>,\n private readonly _keyStorage: KeyStorageFacade,\n private readonly _exchangeDataManager: ExchangeDataManager,\n private readonly _accessControlKeysHeaders: AccessControlKeysHeadersProvider,\n private readonly _delegationsDeAnonymisation: DelegationsDeAnonymization\n ) {}\n\n /**\n * Deletes values cached by the crypto api, to allow to detect changes in stored key pairs, exchange keys and/or current data owner details.\n * This method may be useful in cases where a user is logged in from multiple devices or in cases where other users have just shared some data with\n * the current user for the first time.\n */\n async forceReload() {\n await this._exchangeKeysManager.reloadCache()\n this._dataOwnerApi.clearCurrentDataOwnerIdsCache()\n await this._keyManager.reloadKeys()\n await this._exchangeDataManager.clearOrRepopulateCache()\n }\n\n /**\n * Get all key pairs available for the decrpytion and encryption of data to the current data owner. These include the key pairs from the data owner\n * and his parents.\n * @return an object with:\n * - `self` an object containing the current data owner id and the list of key pairs available for the current data owner with verification details.\n * - `parents` the list of parents to the current data owner with the list of key pairs available for each parent. The list is ordered from the\n * topmost ancestor (at index 0) to the direct parent of the current data owner (at the last index, may be 0).\n */\n getEncryptionDecryptionKeypairsForDataOwnerHierarchy(): Promise<{\n self: {\n dataOwnerId: string\n keys: { pair: KeyPair<CryptoKey>; verified: boolean }[]\n }\n parents: {\n dataOwnerId: string\n keys: { pair: KeyPair<CryptoKey>; verified: boolean }[]\n }[]\n }> {\n return this._keyManager.getCurrentUserHierarchyAvailableKeypairs()\n }\n\n /**\n * Get a key pair with the provided fingerprint if present.\n * @param fingerprint a key-pair/public-key fingerprint\n * @return the pair associated to the fingerprint and a boolean indicating if the pair is verified, if present, else undefined\n */\n getKeyPairForFingerprint(fingerprint: string): { pair: KeyPair<CryptoKey>; verified: boolean } | undefined {\n return this._keyManager.getKeyPairForFingerprint(fingerprint)\n }\n\n /**\n * Get the public keys of available key pairs for the current user and his parents in hex-encoded spki representation (uses cached keys: no request\n * is done to the server).\n * Note that this will also include unverified keys.\n * @return the spki representation of public keys of available keypairs for the current user.\n */\n async getCurrentUserHierarchyAvailablePublicKeysHex(): Promise<string[]> {\n return this._keyManager.getCurrentUserHierarchyAvailablePublicKeysHex()\n }\n\n /**\n * Get the public keys of available key pairs for the current user in hex-encoded spki representation (uses cached keys: no request is done to the\n * server).\n * By setting {@link verifiedOnly} to true only the public keys for verified key pairs will be returned: these will include only key pairs created\n * on this device or which have been verified using {@link CryptoStrategies} on this device.\n * @param verifiedOnly if true only the verified public keys will be returned.\n * @return the spki representation of public keys of available keypairs for the current user.\n */\n async getCurrentUserAvailablePublicKeysHex(verifiedOnly: boolean): Promise<string[]> {\n return this._keyManager.getCurrentUserAvailablePublicKeysHex(verifiedOnly)\n }\n}\n"]}
|
|
@@ -11,6 +11,7 @@ import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest
|
|
|
11
11
|
import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
|
|
12
12
|
import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
|
|
13
13
|
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
|
|
14
|
+
import { SecretIdUseOption } from './crypto/SecretIdUseOption';
|
|
14
15
|
export declare class IccDocumentXApi extends IccDocumentApi implements EncryptedEntityXApi<models.Document> {
|
|
15
16
|
private crypto;
|
|
16
17
|
private authApi;
|
|
@@ -53,7 +54,7 @@ export declare class IccDocumentXApi extends IccDocumentApi implements Encrypted
|
|
|
53
54
|
additionalDelegates?: {
|
|
54
55
|
[dataOwnerId: string]: AccessLevelEnum;
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
+
sfkOption?: SecretIdUseOption;
|
|
57
58
|
}): Promise<models.Document>;
|
|
58
59
|
/**
|
|
59
60
|
* @deprecated use {@link findIdsByMessage} instead.
|
|
@@ -19,6 +19,7 @@ const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
|
19
19
|
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
20
20
|
const utils_1 = require("./utils");
|
|
21
21
|
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
22
|
+
const SecretIdUseOption_1 = require("./crypto/SecretIdUseOption");
|
|
22
23
|
// noinspection JSUnusedGlobalSymbols
|
|
23
24
|
class IccDocumentXApi extends icc_api_1.IccDocumentApi {
|
|
24
25
|
constructor(host, headers, crypto, authApi, dataOwnerApi, autofillAuthor, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
@@ -443,17 +444,13 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
|
|
|
443
444
|
newInstance(user, message, c = {}, options = {}) {
|
|
444
445
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
445
446
|
return __awaiter(this, void 0, void 0, function* () {
|
|
446
|
-
if (!message && options.preferredSfk)
|
|
447
|
-
throw new Error('You need to specify parent message in order to use secret foreign keys.');
|
|
448
447
|
const document = Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { _type: 'org.taktik.icure.entities.Document', id: (_a = c === null || c === void 0 ? void 0 : c.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = c === null || c === void 0 ? void 0 : c.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = c === null || c === void 0 ? void 0 : c.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = c === null || c === void 0 ? void 0 : c.responsible) !== null && _d !== void 0 ? _d : (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined), author: (_e = c === null || c === void 0 ? void 0 : c.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined), codes: (_f = c === null || c === void 0 ? void 0 : c.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = c === null || c === void 0 ? void 0 : c.tags) !== null && _g !== void 0 ? _g : [] });
|
|
449
448
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
450
449
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
451
450
|
throw new Error('Can only initialise entities as current data owner.');
|
|
452
451
|
const sfk = message
|
|
453
|
-
? (_h = options.
|
|
454
|
-
:
|
|
455
|
-
if (message && !sfk)
|
|
456
|
-
throw new Error(`Couldn't find any sfk of parent message ${message.id}`);
|
|
452
|
+
? yield this.crypto.xapi.resolveSecretIdUseOptions({ entity: message, type: utils_1.EntityWithDelegationTypeName.Message }, (_h = options.sfkOption) !== null && _h !== void 0 ? _h : SecretIdUseOption_1.SecretIdUseOption.UseAnySharedWithParent)
|
|
453
|
+
: [];
|
|
457
454
|
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []), ...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.medicalInformation) !== null && _m !== void 0 ? _m : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_o = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _o !== void 0 ? _o : {}));
|
|
458
455
|
return new models.Document(yield this.crypto.xapi
|
|
459
456
|
.entityWithInitialisedEncryptedMetadata(document, utils_1.EntityWithDelegationTypeName.Document, message === null || message === void 0 ? void 0 : message.id, sfk, true, extraDelegations)
|