@icure/api 8.4.14 → 8.5.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.
Files changed (36) hide show
  1. package/icc-api/api/IccApplicationsettingsApi.d.ts +13 -1
  2. package/icc-api/api/IccApplicationsettingsApi.js +70 -24
  3. package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
  4. package/icc-api/api/IccDocumentApi.js +1 -1
  5. package/icc-api/api/IccDocumentApi.js.map +1 -1
  6. package/icc-api/model/ApplicationSettings.d.ts +32 -0
  7. package/icc-api/model/ApplicationSettings.js.map +1 -1
  8. package/icc-x-api/filters/ServiceByHcPartyMonthCodePrefixFilter.d.ts +22 -0
  9. package/icc-x-api/filters/ServiceByHcPartyMonthCodePrefixFilter.js +19 -0
  10. package/icc-x-api/filters/ServiceByHcPartyMonthCodePrefixFilter.js.map +1 -0
  11. package/icc-x-api/filters/ServiceByHcPartyMonthTagPrefixFilter.d.ts +22 -0
  12. package/icc-x-api/filters/ServiceByHcPartyMonthTagPrefixFilter.js +19 -0
  13. package/icc-x-api/filters/ServiceByHcPartyMonthTagPrefixFilter.js.map +1 -0
  14. package/icc-x-api/filters/ServiceByHcPartyPatientCodePrefixFilter.d.ts +20 -0
  15. package/icc-x-api/filters/ServiceByHcPartyPatientCodePrefixFilter.js +18 -0
  16. package/icc-x-api/filters/ServiceByHcPartyPatientCodePrefixFilter.js.map +1 -0
  17. package/icc-x-api/filters/ServiceByHcPartyPatientTagPrefixFilter.d.ts +20 -0
  18. package/icc-x-api/filters/ServiceByHcPartyPatientTagPrefixFilter.js +18 -0
  19. package/icc-x-api/filters/ServiceByHcPartyPatientTagPrefixFilter.js.map +1 -0
  20. package/icc-x-api/icc-application-settings-x-api.d.ts +76 -0
  21. package/icc-x-api/icc-application-settings-x-api.js +160 -0
  22. package/icc-x-api/icc-application-settings-x-api.js.map +1 -0
  23. package/icc-x-api/index.d.ts +3 -2
  24. package/icc-x-api/index.js +2 -1
  25. package/icc-x-api/index.js.map +1 -1
  26. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +1 -0
  27. package/icc-x-api/utils/EntityWithDelegationTypeName.js +2 -0
  28. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
  29. package/package.json +1 -1
  30. package/test/icc-x-api/icc-application-settings-x-api.d.ts +1 -0
  31. package/test/icc-x-api/icc-application-settings-x-api.js +91 -0
  32. package/test/icc-x-api/icc-application-settings-x-api.js.map +1 -0
  33. package/test/icc-x-api/icc-contact-x-api.js +74 -0
  34. package/test/icc-x-api/icc-contact-x-api.js.map +1 -1
  35. package/test/utils/roles.js +8 -0
  36. package/test/utils/roles.js.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceByHcPartyMonthTagPrefixFilter.js","sourceRoot":"","sources":["../../../icc-x-api/filters/ServiceByHcPartyMonthTagPrefixFilter.ts"],"names":[],"mappings":";;;AAAA,qFAAiF;AAEjF,MAAa,oCAAqC,SAAQ,6CAAqB;IAE7E,YAAY,IASX;QACC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAXnB,UAAK,GAA2C,sCAAsC,CAAA;QAY7F,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;IACvC,CAAC;CAUF;AA9BD,oFA8BC","sourcesContent":["import { AbstractFilterService } from '../../icc-api/model/AbstractFilterService'\n\nexport class ServiceByHcPartyMonthTagPrefixFilter extends AbstractFilterService {\n readonly $type: 'ServiceByHcPartyMonthTagPrefixFilter' = 'ServiceByHcPartyMonthTagPrefixFilter'\n constructor(base: {\n healthcarePartyId: string\n year: number | undefined\n month: number | undefined\n tagType: string\n tagCodePrefix: string\n startValueDate?: number\n endValueDate?: number\n desc?: string\n }) {\n super({ desc: base.desc })\n this.healthcarePartyId = base.healthcarePartyId\n this.year = base.year\n this.month = base.month\n this.tagType = base.tagType\n this.tagCodePrefix = base.tagCodePrefix\n this.startValueDate = base.startValueDate\n this.endValueDate = base.endValueDate\n }\n\n desc: string | undefined\n healthcarePartyId: string\n year: number | undefined\n month: number | undefined\n tagType: string\n tagCodePrefix: string\n startValueDate: number | undefined\n endValueDate: number | undefined\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { AbstractFilterService } from '../../icc-api/model/AbstractFilterService';
2
+ export declare class ServiceByHcPartyPatientCodePrefixFilter extends AbstractFilterService {
3
+ readonly $type: 'ServiceByHcPartyPatientCodePrefixFilter';
4
+ constructor(base: {
5
+ healthcarePartyId: string;
6
+ patientSecretForeignKeys: string[];
7
+ codeType: string;
8
+ codeCodePrefix: string;
9
+ startValueDate?: number;
10
+ endValueDate?: number;
11
+ desc?: string;
12
+ });
13
+ desc: string | undefined;
14
+ healthcarePartyId: string;
15
+ patientSecretForeignKeys: string[];
16
+ codeType: string;
17
+ codeCodePrefix: string;
18
+ startValueDate: number | undefined;
19
+ endValueDate: number | undefined;
20
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServiceByHcPartyPatientCodePrefixFilter = void 0;
4
+ const AbstractFilterService_1 = require("../../icc-api/model/AbstractFilterService");
5
+ class ServiceByHcPartyPatientCodePrefixFilter extends AbstractFilterService_1.AbstractFilterService {
6
+ constructor(base) {
7
+ super({ desc: base.desc });
8
+ this.$type = 'ServiceByHcPartyPatientCodePrefixFilter';
9
+ this.healthcarePartyId = base.healthcarePartyId;
10
+ this.patientSecretForeignKeys = base.patientSecretForeignKeys;
11
+ this.codeType = base.codeType;
12
+ this.codeCodePrefix = base.codeCodePrefix;
13
+ this.startValueDate = base.startValueDate;
14
+ this.endValueDate = base.endValueDate;
15
+ }
16
+ }
17
+ exports.ServiceByHcPartyPatientCodePrefixFilter = ServiceByHcPartyPatientCodePrefixFilter;
18
+ //# sourceMappingURL=ServiceByHcPartyPatientCodePrefixFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceByHcPartyPatientCodePrefixFilter.js","sourceRoot":"","sources":["../../../icc-x-api/filters/ServiceByHcPartyPatientCodePrefixFilter.ts"],"names":[],"mappings":";;;AAAA,qFAAiF;AAEjF,MAAa,uCAAwC,SAAQ,6CAAqB;IAEhF,YAAY,IAQX;QACC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAVnB,UAAK,GAA8C,yCAAyC,CAAA;QAWnG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QAC/C,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAA;QAC7D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;IACvC,CAAC;CASF;AA3BD,0FA2BC","sourcesContent":["import { AbstractFilterService } from '../../icc-api/model/AbstractFilterService'\n\nexport class ServiceByHcPartyPatientCodePrefixFilter extends AbstractFilterService {\n readonly $type: 'ServiceByHcPartyPatientCodePrefixFilter' = 'ServiceByHcPartyPatientCodePrefixFilter'\n constructor(base: {\n healthcarePartyId: string\n patientSecretForeignKeys: string[]\n codeType: string\n codeCodePrefix: string\n startValueDate?: number\n endValueDate?: number\n desc?: string\n }) {\n super({ desc: base.desc })\n this.healthcarePartyId = base.healthcarePartyId\n this.patientSecretForeignKeys = base.patientSecretForeignKeys\n this.codeType = base.codeType\n this.codeCodePrefix = base.codeCodePrefix\n this.startValueDate = base.startValueDate\n this.endValueDate = base.endValueDate\n }\n\n desc: string | undefined\n healthcarePartyId: string\n patientSecretForeignKeys: string[]\n codeType: string\n codeCodePrefix: string\n startValueDate: number | undefined\n endValueDate: number | undefined\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { AbstractFilterService } from '../../icc-api/model/AbstractFilterService';
2
+ export declare class ServiceByHcPartyPatientTagPrefixFilter extends AbstractFilterService {
3
+ readonly $type: 'ServiceByHcPartyPatientTagPrefixFilter';
4
+ constructor(base: {
5
+ healthcarePartyId: string;
6
+ patientSecretForeignKeys: string[];
7
+ tagType: string;
8
+ tagCodePrefix: string;
9
+ startValueDate?: number;
10
+ endValueDate?: number;
11
+ desc?: string;
12
+ });
13
+ desc: string | undefined;
14
+ healthcarePartyId: string;
15
+ patientSecretForeignKeys: string[];
16
+ tagType: string;
17
+ tagCodePrefix: string;
18
+ startValueDate: number | undefined;
19
+ endValueDate: number | undefined;
20
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServiceByHcPartyPatientTagPrefixFilter = void 0;
4
+ const AbstractFilterService_1 = require("../../icc-api/model/AbstractFilterService");
5
+ class ServiceByHcPartyPatientTagPrefixFilter extends AbstractFilterService_1.AbstractFilterService {
6
+ constructor(base) {
7
+ super({ desc: base.desc });
8
+ this.$type = 'ServiceByHcPartyPatientTagPrefixFilter';
9
+ this.healthcarePartyId = base.healthcarePartyId;
10
+ this.patientSecretForeignKeys = base.patientSecretForeignKeys;
11
+ this.tagType = base.tagType;
12
+ this.tagCodePrefix = base.tagCodePrefix;
13
+ this.startValueDate = base.startValueDate;
14
+ this.endValueDate = base.endValueDate;
15
+ }
16
+ }
17
+ exports.ServiceByHcPartyPatientTagPrefixFilter = ServiceByHcPartyPatientTagPrefixFilter;
18
+ //# sourceMappingURL=ServiceByHcPartyPatientTagPrefixFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceByHcPartyPatientTagPrefixFilter.js","sourceRoot":"","sources":["../../../icc-x-api/filters/ServiceByHcPartyPatientTagPrefixFilter.ts"],"names":[],"mappings":";;;AAAA,qFAAiF;AAEjF,MAAa,sCAAuC,SAAQ,6CAAqB;IAE/E,YAAY,IAQX;QACC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAVnB,UAAK,GAA6C,wCAAwC,CAAA;QAWjG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QAC/C,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAA;QAC7D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;IACvC,CAAC;CASF;AA3BD,wFA2BC","sourcesContent":["import { AbstractFilterService } from '../../icc-api/model/AbstractFilterService'\n\nexport class ServiceByHcPartyPatientTagPrefixFilter extends AbstractFilterService {\n readonly $type: 'ServiceByHcPartyPatientTagPrefixFilter' = 'ServiceByHcPartyPatientTagPrefixFilter'\n constructor(base: {\n healthcarePartyId: string\n patientSecretForeignKeys: string[]\n tagType: string\n tagCodePrefix: string\n startValueDate?: number\n endValueDate?: number\n desc?: string\n }) {\n super({ desc: base.desc })\n this.healthcarePartyId = base.healthcarePartyId\n this.patientSecretForeignKeys = base.patientSecretForeignKeys\n this.tagType = base.tagType\n this.tagCodePrefix = base.tagCodePrefix\n this.startValueDate = base.startValueDate\n this.endValueDate = base.endValueDate\n }\n\n desc: string | undefined\n healthcarePartyId: string\n patientSecretForeignKeys: string[]\n tagType: string\n tagCodePrefix: string\n startValueDate: number | undefined\n endValueDate: number | undefined\n}\n"]}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * iCure Data Stack API Documentation
3
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
4
+ *
5
+ * OpenAPI spec version: v1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by the swagger code generator program.
9
+ * https://github.com/swagger-api/swagger-codegen.git
10
+ * Do not edit the class manually.
11
+ */
12
+ import { IccApplicationsettingsApi } from '../icc-api';
13
+ import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
14
+ import * as models from '../icc-api/model/models';
15
+ import { IccCryptoXApi } from './icc-crypto-x-api';
16
+ import { IccDataOwnerXApi } from './icc-data-owner-x-api';
17
+ import { SecretIdUseOption } from './crypto/SecretIdUseOption';
18
+ import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
19
+ import { ShareResult } from './utils/ShareResult';
20
+ import { ApplicationSettings, SecureDelegation, User } from '../icc-api/model/models';
21
+ import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
22
+ import { AuthenticationProvider } from './auth/AuthenticationProvider';
23
+ import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
24
+ import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
25
+ import { XHR } from '../icc-api/api/XHR';
26
+ export declare class IccApplicationSettingsXApi extends IccApplicationsettingsApi implements EncryptedEntityXApi<models.ApplicationSettings> {
27
+ private readonly autofillAuthor;
28
+ crypto: IccCryptoXApi;
29
+ dataOwnerApi: IccDataOwnerXApi;
30
+ private readonly encryptedFields;
31
+ get headers(): Promise<Array<XHR.Header>>;
32
+ constructor(host: string, headers: {
33
+ [key: string]: string;
34
+ }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, autofillAuthor: boolean, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
35
+ newInstance(user: models.User, c?: any, options?: {
36
+ additionalDelegates?: {
37
+ [dataOwnerId: string]: AccessLevelEnum;
38
+ };
39
+ sfkOption?: SecretIdUseOption;
40
+ ignoreAutoDelegations?: boolean;
41
+ alternateRootDelegation?: string;
42
+ }): Promise<models.ApplicationSettings>;
43
+ hasWriteAccess(applicationSettings: models.ApplicationSettings): Promise<boolean>;
44
+ shareWith(delegateId: string, applicationSettings: models.ApplicationSettings, options?: {
45
+ requestedPermissions?: RequestedPermissionEnum;
46
+ shareEncryptionKey?: ShareMetadataBehaviour;
47
+ }): Promise<models.ApplicationSettings>;
48
+ shareWithMany(applicationSettings: models.ApplicationSettings, delegates: {
49
+ [delegateId: string]: {
50
+ requestedPermissions?: RequestedPermissionEnum;
51
+ shareEncryptionKey?: ShareMetadataBehaviour;
52
+ };
53
+ }): Promise<models.ApplicationSettings>;
54
+ tryShareWithMany(applicationSettings: models.ApplicationSettings, delegates: {
55
+ [delegateId: string]: {
56
+ requestedPermissions?: RequestedPermissionEnum;
57
+ shareEncryptionKey?: ShareMetadataBehaviour;
58
+ };
59
+ }): Promise<ShareResult<models.ApplicationSettings>>;
60
+ getDataOwnersWithAccessTo(entity: models.ApplicationSettings): Promise<{
61
+ permissionsByDataOwnerId: {
62
+ [p: string]: AccessLevelEnum;
63
+ };
64
+ hasUnknownAnonymousDataOwners: boolean;
65
+ }>;
66
+ getEncryptionKeysOf(entity: models.ApplicationSettings): Promise<string[]>;
67
+ createDelegationDeAnonymizationMetadata(entity: models.ApplicationSettings, delegates: string[]): Promise<void>;
68
+ createApplicationSettings(body?: ApplicationSettings): Promise<never>;
69
+ getApplicationSettings(): Promise<Array<never>>;
70
+ updateApplicationSettings(body?: ApplicationSettings): Promise<never>;
71
+ createApplicationSettingsWithUser(user: User | undefined, body: ApplicationSettings): Promise<ApplicationSettings>;
72
+ getApplicationSettingsWithUser(user: User | undefined): Promise<Array<ApplicationSettings>>;
73
+ updateApplicationSettingsWithUser(user: User | undefined, body: ApplicationSettings): Promise<ApplicationSettings>;
74
+ private tryDecryptOrReturnOriginal;
75
+ private encrypt;
76
+ }
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.IccApplicationSettingsXApi = void 0;
13
+ /**
14
+ * iCure Data Stack API Documentation
15
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
16
+ *
17
+ * OpenAPI spec version: v1
18
+ *
19
+ *
20
+ * NOTE: This class is auto generated by the swagger code generator program.
21
+ * https://github.com/swagger-api/swagger-codegen.git
22
+ * Do not edit the class manually.
23
+ */
24
+ const icc_api_1 = require("../icc-api");
25
+ const models = require("../icc-api/model/models");
26
+ const utils_1 = require("./utils");
27
+ const ShareMetadataBehaviour_1 = require("./crypto/ShareMetadataBehaviour");
28
+ const models_1 = require("../icc-api/model/models");
29
+ var AccessLevelEnum = models_1.SecureDelegation.AccessLevelEnum;
30
+ const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
31
+ class IccApplicationSettingsXApi extends icc_api_1.IccApplicationsettingsApi {
32
+ get headers() {
33
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, utils_1.EntityWithDelegationTypeName.ApplicationSettings));
34
+ }
35
+ constructor(host, headers, crypto, dataOwnerApi, autofillAuthor, encryptedKeys = ['encryptedSettings'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
36
+ ? window.fetch
37
+ : typeof self !== 'undefined'
38
+ ? self.fetch
39
+ : fetch) {
40
+ super(host, headers, authenticationProvider, fetchImpl);
41
+ this.autofillAuthor = autofillAuthor;
42
+ this.crypto = crypto;
43
+ this.dataOwnerApi = dataOwnerApi;
44
+ this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'ApplicationSettings.');
45
+ }
46
+ newInstance(user_1) {
47
+ return __awaiter(this, arguments, void 0, function* (user, c = {}, options = {}) {
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
49
+ const applicationSettings = Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { _type: 'org.taktik.icure.entities.ApplicationSettings', 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) });
50
+ const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
51
+ if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
52
+ throw new Error('Can only initialise entities as current data owner.');
53
+ const extraDelegations = Object.assign(Object.assign({}, (options.ignoreAutoDelegations == true
54
+ ? {}
55
+ : Object.fromEntries([...((_g = (_f = user.autoDelegations) === null || _f === void 0 ? void 0 : _f.all) !== null && _g !== void 0 ? _g : []), ...((_j = (_h = user.autoDelegations) === null || _h === void 0 ? void 0 : _h.medicalInformation) !== null && _j !== void 0 ? _j : [])].map((d) => [d, AccessLevelEnum.WRITE])))), ((_k = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _k !== void 0 ? _k : {}));
56
+ return new models.ApplicationSettings(yield this.crypto.xapi
57
+ .entityWithInitialisedEncryptedMetadata(applicationSettings, utils_1.EntityWithDelegationTypeName.ApplicationSettings, undefined, [], true, extraDelegations, options.alternateRootDelegation)
58
+ .then((x) => x.updatedEntity));
59
+ });
60
+ }
61
+ hasWriteAccess(applicationSettings) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ return this.crypto.xapi.hasWriteAccess({ entity: applicationSettings, type: utils_1.EntityWithDelegationTypeName.ApplicationSettings });
64
+ });
65
+ }
66
+ shareWith(delegateId_1, applicationSettings_1) {
67
+ return __awaiter(this, arguments, void 0, function* (delegateId, applicationSettings, options = {}) {
68
+ return this.shareWithMany(applicationSettings, { [delegateId]: options });
69
+ });
70
+ }
71
+ shareWithMany(applicationSettings, delegates) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ return (yield this.tryShareWithMany(applicationSettings, delegates)).updatedEntityOrThrow;
74
+ });
75
+ }
76
+ tryShareWithMany(applicationSettings, delegates) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ // All entities should have an encryption key.
79
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(applicationSettings, utils_1.EntityWithDelegationTypeName.ApplicationSettings);
80
+ const updatedEntity = entityWithEncryptionKey
81
+ ? yield this.updateApplicationSettingsWithUser(undefined, entityWithEncryptionKey)
82
+ : applicationSettings;
83
+ return this.crypto.xapi.simpleShareOrUpdateEncryptedEntityMetadata({
84
+ entity: updatedEntity,
85
+ type: utils_1.EntityWithDelegationTypeName.ApplicationSettings,
86
+ }, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
87
+ delegateId,
88
+ {
89
+ requestedPermissions: options.requestedPermissions,
90
+ shareEncryptionKeys: options.shareEncryptionKey,
91
+ shareOwningEntityIds: ShareMetadataBehaviour_1.ShareMetadataBehaviour.NEVER,
92
+ shareSecretIds: [],
93
+ },
94
+ ])), (x) => this.bulkShareApplicationSettings(x));
95
+ });
96
+ }
97
+ getDataOwnersWithAccessTo(entity) {
98
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: utils_1.EntityWithDelegationTypeName.ApplicationSettings });
99
+ }
100
+ getEncryptionKeysOf(entity) {
101
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: utils_1.EntityWithDelegationTypeName.ApplicationSettings }, undefined);
102
+ }
103
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
104
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: utils_1.EntityWithDelegationTypeName.ApplicationSettings }, delegates);
105
+ }
106
+ createApplicationSettings(body) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ throw new Error('Use withUser method');
109
+ });
110
+ }
111
+ getApplicationSettings() {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ throw new Error('Use withUser method');
114
+ });
115
+ }
116
+ updateApplicationSettings(body) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ throw new Error('Use withUser method');
119
+ });
120
+ }
121
+ createApplicationSettingsWithUser(user, body) {
122
+ const _super = Object.create(null, {
123
+ createApplicationSettings: { get: () => super.createApplicationSettings }
124
+ });
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ if (body.securityMetadata == null)
127
+ throw new Error('Application settings does not have initialized encryption metadata; initialize or use non-encrypted api');
128
+ return _super.createApplicationSettings.call(this, (yield this.encrypt([body]))[0]);
129
+ });
130
+ }
131
+ getApplicationSettingsWithUser(user) {
132
+ const _super = Object.create(null, {
133
+ getApplicationSettings: { get: () => super.getApplicationSettings }
134
+ });
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const retrieved = yield _super.getApplicationSettings.call(this);
137
+ return (yield this.tryDecryptOrReturnOriginal(retrieved)).map((x) => x.entity);
138
+ });
139
+ }
140
+ updateApplicationSettingsWithUser(user, body) {
141
+ const _super = Object.create(null, {
142
+ updateApplicationSettings: { get: () => super.updateApplicationSettings }
143
+ });
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ if (body.securityMetadata == null)
146
+ throw new Error('Application settings does not have initialized encryption metadata; initialize or use non-encrypted api');
147
+ return _super.updateApplicationSettings.call(this, (yield this.encrypt([body]))[0]);
148
+ });
149
+ }
150
+ tryDecryptOrReturnOriginal(applicationSettings) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ return yield this.crypto.xapi.tryDecryptEntities(applicationSettings, utils_1.EntityWithDelegationTypeName.ApplicationSettings, (x) => new models.ApplicationSettings(x));
153
+ });
154
+ }
155
+ encrypt(applicationSettings) {
156
+ return this.crypto.xapi.tryEncryptEntities(applicationSettings, utils_1.EntityWithDelegationTypeName.ApplicationSettings, this.encryptedFields, true, false, (x) => new models.ApplicationSettings(x));
157
+ }
158
+ }
159
+ exports.IccApplicationSettingsXApi = IccApplicationSettingsXApi;
160
+ //# sourceMappingURL=icc-application-settings-x-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icc-application-settings-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-application-settings-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,wCAAsD;AAEtD,kDAAiD;AAGjD,mCAAqG;AAErG,4EAAwE;AAExE,oDAAqF;AACrF,IAAO,eAAe,GAAG,yBAAgB,CAAC,eAAe,CAAA;AACzD,0EAAgG;AAKhG,MAAa,0BAA2B,SAAQ,mCAAyB;IAKvE,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9B,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,oCAA4B,CAAC,mBAAmB,CAAC,CACtH,CAAA;IACH,CAAC;IAED,YACE,IAA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2MC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { IccApplicationsettingsApi } from '../icc-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport * as models from '../icc-api/model/models'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { ApplicationSettings, SecureDelegation, User } from '../icc-api/model/models'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { XHR } from '../icc-api/api/XHR'\n\nexport class IccApplicationSettingsXApi extends IccApplicationsettingsApi implements EncryptedEntityXApi<models.ApplicationSettings> {\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) =>\n this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.ApplicationSettings)\n )\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n encryptedKeys: Array<string> = ['encryptedSettings'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'ApplicationSettings.')\n }\n\n async newInstance(\n user: models.User,\n c: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean\n alternateRootDelegation?: string\n } = {}\n ): Promise<models.ApplicationSettings> {\n const applicationSettings = {\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.ApplicationSettings',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n }\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.ApplicationSettings(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n applicationSettings,\n EntityWithDelegationTypeName.ApplicationSettings,\n undefined,\n [],\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n async hasWriteAccess(applicationSettings: models.ApplicationSettings): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: applicationSettings, type: EntityWithDelegationTypeName.ApplicationSettings })\n }\n\n async shareWith(\n delegateId: string,\n applicationSettings: models.ApplicationSettings,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.ApplicationSettings> {\n return this.shareWithMany(applicationSettings, { [delegateId]: options })\n }\n\n async shareWithMany(\n applicationSettings: models.ApplicationSettings,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.ApplicationSettings> {\n return (await this.tryShareWithMany(applicationSettings, delegates)).updatedEntityOrThrow\n }\n\n async tryShareWithMany(\n applicationSettings: models.ApplicationSettings,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.ApplicationSettings>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(\n applicationSettings,\n EntityWithDelegationTypeName.ApplicationSettings\n )\n const updatedEntity = entityWithEncryptionKey\n ? await this.updateApplicationSettingsWithUser(undefined, entityWithEncryptionKey)\n : applicationSettings\n return this.crypto.xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.ApplicationSettings,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: [],\n },\n ])\n ),\n (x) => this.bulkShareApplicationSettings(x)\n )\n }\n\n getDataOwnersWithAccessTo(\n entity: models.ApplicationSettings\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.ApplicationSettings })\n }\n\n getEncryptionKeysOf(entity: models.ApplicationSettings): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.ApplicationSettings }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: models.ApplicationSettings, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.ApplicationSettings },\n delegates\n )\n }\n\n async createApplicationSettings(body?: ApplicationSettings): Promise<never> {\n throw new Error('Use withUser method')\n }\n async getApplicationSettings(): Promise<Array<never>> {\n throw new Error('Use withUser method')\n }\n async updateApplicationSettings(body?: ApplicationSettings): Promise<never> {\n throw new Error('Use withUser method')\n }\n\n async createApplicationSettingsWithUser(user: User | undefined, body: ApplicationSettings): Promise<ApplicationSettings> {\n if (body.securityMetadata == null)\n throw new Error('Application settings does not have initialized encryption metadata; initialize or use non-encrypted api')\n return super.createApplicationSettings((await this.encrypt([body]))[0])\n }\n\n async getApplicationSettingsWithUser(user: User | undefined): Promise<Array<ApplicationSettings>> {\n const retrieved = await super.getApplicationSettings()\n return (await this.tryDecryptOrReturnOriginal(retrieved)).map((x) => x.entity)\n }\n\n async updateApplicationSettingsWithUser(user: User | undefined, body: ApplicationSettings): Promise<ApplicationSettings> {\n if (body.securityMetadata == null)\n throw new Error('Application settings does not have initialized encryption metadata; initialize or use non-encrypted api')\n return super.updateApplicationSettings((await this.encrypt([body]))[0])\n }\n\n private async tryDecryptOrReturnOriginal(\n applicationSettings: Array<models.ApplicationSettings>\n ): Promise<{ entity: models.ApplicationSettings; decrypted: boolean }[]> {\n return await this.crypto.xapi.tryDecryptEntities(\n applicationSettings,\n EntityWithDelegationTypeName.ApplicationSettings,\n (x) => new models.ApplicationSettings(x)\n )\n }\n\n private encrypt(applicationSettings: Array<models.ApplicationSettings>): Promise<Array<models.ApplicationSettings>> {\n return this.crypto.xapi.tryEncryptEntities(\n applicationSettings,\n EntityWithDelegationTypeName.ApplicationSettings,\n this.encryptedFields,\n true,\n false,\n (x) => new models.ApplicationSettings(x)\n )\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { IccAgendaApi, IccAnonymousAccessApi, IccApplicationsettingsApi, IccAuthApi, IccBeefactApi, IccBeresultexportApi, IccBeresultimportApi, IccBesamv2Api, IccCalendarItemTypeApi, IccClassificationTemplateApi, IccEntityrefApi, IccEntitytemplateApi, IccFrontendmigrationApi, IccGroupApi, IccIcureApi, IccInsuranceApi, IccKeywordApi, IccMedexApi, IccMedicallocationApi, IccPatientApi, IccPermissionApi, IccPlaceApi, IccPubsubApi, IccReplicationApi, IccTarificationApi, IccTimeTableApi, IccTmpApi } from '../icc-api';
1
+ import { IccAgendaApi, IccAnonymousAccessApi, IccAuthApi, IccBeefactApi, IccBeresultexportApi, IccBeresultimportApi, IccBesamv2Api, IccCalendarItemTypeApi, IccClassificationTemplateApi, IccEntityrefApi, IccEntitytemplateApi, IccFrontendmigrationApi, IccGroupApi, IccIcureApi, IccInsuranceApi, IccKeywordApi, IccMedexApi, IccMedicallocationApi, IccPatientApi, IccPermissionApi, IccPlaceApi, IccPubsubApi, IccReplicationApi, IccTarificationApi, IccTimeTableApi, IccTmpApi } from '../icc-api';
2
2
  import { IccUserXApi } from './icc-user-x-api';
3
3
  import { IccCryptoXApi } from './icc-crypto-x-api';
4
4
  import { IccContactXApi } from './icc-contact-x-api';
@@ -31,6 +31,7 @@ import { IccTopicXApi } from './icc-topic-x-api';
31
31
  import { IccRoleApi } from '../icc-api/api/IccRoleApi';
32
32
  import { AuthSecretProvider, SmartAuthProviderInitialSecret } from './auth/SmartAuthProvider';
33
33
  import { IccRecoveryXApi } from './icc-recovery-x-api';
34
+ import { IccApplicationSettingsXApi } from './icc-application-settings-x-api';
34
35
  export * from './icc-accesslog-x-api';
35
36
  export * from './icc-bekmehr-x-api';
36
37
  export * from './icc-calendar-item-x-api';
@@ -100,7 +101,7 @@ export interface Apis extends BasicApis {
100
101
  readonly dataOwnerApi: IccDataOwnerXApi;
101
102
  readonly icureMaintenanceTaskApi: IccIcureMaintenanceXApi;
102
103
  readonly anonymousAccessApi: IccAnonymousAccessApi;
103
- readonly applicationSettingsApi: IccApplicationsettingsApi;
104
+ readonly applicationSettingsApi: IccApplicationSettingsXApi;
104
105
  readonly bekmehrApi: IccBekmehrXApi;
105
106
  readonly beefactApi: IccBeefactApi;
106
107
  readonly beresultexportApi: IccBeresultexportApi;
@@ -81,6 +81,7 @@ const RecoveryDataEncryption_1 = require("./crypto/RecoveryDataEncryption");
81
81
  const icc_recovery_x_api_1 = require("./icc-recovery-x-api");
82
82
  const JwtUtils_1 = require("./auth/JwtUtils");
83
83
  const SecurityMetadataDecryptor_1 = require("./crypto/SecurityMetadataDecryptor");
84
+ const icc_application_settings_x_api_1 = require("./icc-application-settings-x-api");
84
85
  __exportStar(require("./icc-accesslog-x-api"), exports);
85
86
  __exportStar(require("./icc-bekmehr-x-api"), exports);
86
87
  __exportStar(require("./icc-calendar-item-x-api"), exports);
@@ -435,7 +436,7 @@ class IcureApiImpl {
435
436
  }
436
437
  get applicationSettingsApi() {
437
438
  var _a;
438
- return ((_a = this._applicationSettingsApi) !== null && _a !== void 0 ? _a : (this._applicationSettingsApi = new icc_api_1.IccApplicationsettingsApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
439
+ return ((_a = this._applicationSettingsApi) !== null && _a !== void 0 ? _a : (this._applicationSettingsApi = new icc_application_settings_x_api_1.IccApplicationSettingsXApi(this.host, this.cryptoInitInfos.headers, this.cryptoInitInfos.cryptoApi, this.cryptoInitInfos.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, ['encryptedSettings'], this.groupSpecificAuthenticationProvider, this.fetch)));
439
440
  }
440
441
  get bekmehrApi() {
441
442
  var _a;