@icure/api 4.2.27 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccDeviceApi.d.ts +3 -3
- package/icc-api/api/IccDeviceApi.js.map +1 -1
- package/icc-api/api/IccHcpartyApi.d.ts +3 -3
- package/icc-api/api/IccHcpartyApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +3 -3
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccUserApi.js +1 -1
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/api/XHR.js +2 -1
- package/icc-api/api/XHR.js.map +1 -1
- package/icc-api/iccApi.js +5 -1
- package/icc-api/iccApi.js.map +1 -1
- package/icc-api/index.js +5 -1
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/Body.js +1 -1
- package/icc-api/model/Body.js.map +1 -1
- package/icc-api/model/Body1.js +1 -1
- package/icc-api/model/Body1.js.map +1 -1
- package/icc-api/model/Body2.js +1 -1
- package/icc-api/model/Body2.js.map +1 -1
- package/icc-api/model/Body3.js +1 -1
- package/icc-api/model/Body3.js.map +1 -1
- package/icc-api/model/ByteArray.js +1 -1
- package/icc-api/model/ByteArray.js.map +1 -1
- package/icc-api/model/Content.js +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/Device.js +1 -1
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.js +1 -1
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/DocumentTemplate.js +1 -1
- package/icc-api/model/DocumentTemplate.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/MimeAttachment.js +1 -1
- package/icc-api/model/MimeAttachment.js.map +1 -1
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/models.d.ts +15 -0
- package/icc-api/model/models.js +5 -1
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/crypto/AES.d.ts +2 -1
- package/icc-x-api/crypto/AES.js +37 -10
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/RSA.d.ts +0 -31
- package/icc-x-api/crypto/RSA.js +0 -64
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/shamir.js.map +1 -1
- package/icc-x-api/filters/filters.js +7 -3
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +25 -22
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-bekmehr-x-api.js +2 -2
- package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
- package/icc-x-api/icc-calendar-item-x-api.js +43 -30
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.js +59 -45
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +124 -53
- package/icc-x-api/icc-crypto-x-api.js +777 -362
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js +2 -2
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.js +3 -3
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +3 -3
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.js +6 -11
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +8 -8
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +5 -5
- package/icc-x-api/icc-maintenance-task-x-api.js +13 -14
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +1 -1
- package/icc-x-api/icc-patient-x-api.js +66 -56
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +16 -15
- package/icc-x-api/index.js +77 -58
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/binary-utils.js +5 -5
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +61 -0
- package/icc-x-api/utils/crypto-utils.js +245 -0
- package/icc-x-api/utils/crypto-utils.js.map +1 -0
- package/icc-x-api/utils/formatting-util.js +3 -3
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/functional-util.d.ts +1 -0
- package/icc-x-api/utils/functional-util.js +8 -1
- package/icc-x-api/utils/functional-util.js.map +1 -1
- package/icc-x-api/utils/index.d.ts +1 -0
- package/icc-x-api/utils/index.js +6 -1
- package/icc-x-api/utils/index.js.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/node-compat.d.ts +1 -1
- package/node-compat.js +3 -3
- package/node-compat.js.map +1 -1
- package/package.json +2 -2
- package/icc-x-api/crypto/utils.d.ts +0 -68
- package/icc-x-api/crypto/utils.js +0 -239
- package/icc-x-api/crypto/utils.js.map +0 -1
package/icc-x-api/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -9,8 +13,17 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
12
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Api = exports.apiHeaders =
|
|
26
|
+
exports.Api = exports.apiHeaders = void 0;
|
|
14
27
|
const icc_api_1 = require("../icc-api");
|
|
15
28
|
const icc_user_x_api_1 = require("./icc-user-x-api");
|
|
16
29
|
const icc_crypto_x_api_1 = require("./icc-crypto-x-api");
|
|
@@ -48,13 +61,11 @@ __exportStar(require("./icc-patient-x-api"), exports);
|
|
|
48
61
|
__exportStar(require("./icc-user-x-api"), exports);
|
|
49
62
|
__exportStar(require("./icc-time-table-x-api"), exports);
|
|
50
63
|
__exportStar(require("./icc-receipt-x-api"), exports);
|
|
51
|
-
var utils_1 = require("./crypto/utils");
|
|
52
|
-
Object.defineProperty(exports, "utils", { enumerable: true, get: function () { return utils_1.utils; } });
|
|
53
|
-
Object.defineProperty(exports, "UtilsClass", { enumerable: true, get: function () { return utils_1.UtilsClass; } });
|
|
54
64
|
__exportStar(require("./utils"), exports);
|
|
55
|
-
const apiHeaders = function (username, password) {
|
|
65
|
+
const apiHeaders = function (username, password, forceBasic = false) {
|
|
56
66
|
return {
|
|
57
67
|
Authorization: `Basic ${typeof btoa !== 'undefined' ? btoa(`${username}:${password}`) : Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
68
|
+
'force-authentication': forceBasic ? 'true' : 'false',
|
|
58
69
|
};
|
|
59
70
|
};
|
|
60
71
|
exports.apiHeaders = apiHeaders;
|
|
@@ -62,58 +73,66 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
|
|
|
62
73
|
? window.fetch
|
|
63
74
|
: typeof self !== 'undefined'
|
|
64
75
|
? self.fetch
|
|
65
|
-
: fetch) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
76
|
+
: fetch, forceBasic = false) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const headers = (0, exports.apiHeaders)(username, password, forceBasic);
|
|
79
|
+
const authApi = new icc_api_1.IccAuthApi(host, headers, fetchImpl);
|
|
80
|
+
const codeApi = new icc_code_x_api_1.IccCodeXApi(host, headers, fetchImpl);
|
|
81
|
+
const entityReferenceApi = new icc_api_1.IccEntityrefApi(host, headers, fetchImpl);
|
|
82
|
+
const userApi = new icc_user_x_api_1.IccUserXApi(host, headers, fetchImpl);
|
|
83
|
+
const permissionApi = new icc_api_1.IccPermissionApi(host, headers, fetchImpl);
|
|
84
|
+
const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, headers, fetchImpl);
|
|
85
|
+
const deviceApi = new IccDeviceApi_1.IccDeviceApi(host, headers, fetchImpl);
|
|
86
|
+
const cryptoApi = new icc_crypto_x_api_1.IccCryptoXApi(host, headers, healthcarePartyApi, new icc_api_1.IccPatientApi(host, headers, fetchImpl), deviceApi, crypto);
|
|
87
|
+
const accessLogApi = new icc_accesslog_x_api_1.IccAccesslogXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
88
|
+
const agendaApi = new icc_api_1.IccAgendaApi(host, headers, fetchImpl);
|
|
89
|
+
const contactApi = new icc_contact_x_api_1.IccContactXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
90
|
+
const formApi = new icc_form_x_api_1.IccFormXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
91
|
+
const groupApi = new icc_api_1.IccGroupApi(host, headers);
|
|
92
|
+
const invoiceApi = new icc_invoice_x_api_1.IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, userApi, fetchImpl);
|
|
93
|
+
const insuranceApi = new icc_api_1.IccInsuranceApi(host, headers, fetchImpl);
|
|
94
|
+
const documentApi = new icc_document_x_api_1.IccDocumentXApi(host, headers, cryptoApi, authApi, userApi, fetchImpl);
|
|
95
|
+
const healthcareElementApi = new icc_helement_x_api_1.IccHelementXApi(host, headers, cryptoApi, userApi, ['descr', 'note'], fetchImpl);
|
|
96
|
+
const classificationApi = new icc_classification_x_api_1.IccClassificationXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
97
|
+
const calendarItemApi = new icc_calendar_item_x_api_1.IccCalendarItemXApi(host, headers, cryptoApi, userApi, ['details', 'title', 'patientId'], fetchImpl);
|
|
98
|
+
const receiptApi = new icc_receipt_x_api_1.IccReceiptXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
99
|
+
const timetableApi = new icc_time_table_x_api_1.IccTimeTableXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
100
|
+
const patientApi = new icc_patient_x_api_1.IccPatientXApi(host, headers, cryptoApi, contactApi, formApi, healthcareElementApi, invoiceApi, documentApi, healthcarePartyApi, classificationApi, userApi, calendarItemApi, ['note'], fetchImpl);
|
|
101
|
+
const messageApi = new icc_message_x_api_1.IccMessageXApi(host, headers, cryptoApi, userApi, fetchImpl);
|
|
102
|
+
const maintenanceTaskApi = new icc_maintenance_task_x_api_1.IccMaintenanceTaskXApi(host, headers, cryptoApi, userApi, healthcarePartyApi, ['properties'], fetchImpl);
|
|
103
|
+
try {
|
|
104
|
+
yield authApi.login({ username, password });
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
console.error('Incorrect user and password used to instantiate Api, or network problem', e);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
cryptoApi,
|
|
111
|
+
authApi,
|
|
112
|
+
codeApi,
|
|
113
|
+
userApi,
|
|
114
|
+
permissionApi,
|
|
115
|
+
patientApi,
|
|
116
|
+
healthcarePartyApi,
|
|
117
|
+
deviceApi,
|
|
118
|
+
accessLogApi,
|
|
119
|
+
contactApi,
|
|
120
|
+
healthcareElementApi,
|
|
121
|
+
documentApi,
|
|
122
|
+
formApi,
|
|
123
|
+
invoiceApi,
|
|
124
|
+
insuranceApi,
|
|
125
|
+
messageApi,
|
|
126
|
+
entityReferenceApi,
|
|
127
|
+
receiptApi,
|
|
128
|
+
agendaApi,
|
|
129
|
+
calendarItemApi,
|
|
130
|
+
classificationApi,
|
|
131
|
+
timetableApi,
|
|
132
|
+
groupApi,
|
|
133
|
+
maintenanceTaskApi,
|
|
134
|
+
};
|
|
135
|
+
});
|
|
117
136
|
};
|
|
118
137
|
exports.Api = Api;
|
|
119
138
|
//# sourceMappingURL=index.js.map
|
package/icc-x-api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,wCAAqI;AACrI,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,yEAAkE;AAClE,uEAA+D;AAC/D,2DAAoD;AACpD,2DAAoD;AACpD,2DAAoD;AACpD,+DAAwD;AACxD,iEAAyD;AACzD,8DAA0D;AAC1D,qDAA8C;AAC9C,6EAAmE;AAEnE,wDAAqC;AACrC,sDAAmC;AACnC,4DAAyC;AACzC,6DAA0C;AAC1C,mDAAgC;AAChC,sDAAmC;AACnC,qDAAkC;AAClC,0DAAuC;AACvC,uDAAoC;AACpC,mDAAgC;AAChC,sDAAmC;AACnC,uDAAoC;AACpC,sDAAmC;AACnC,sDAAmC;AACnC,sDAAmC;AACnC,mDAAgC;AAChC,yDAAsC;AACtC,sDAAmC;AACnC,wCAAkD;AAAzC,8FAAA,KAAK,OAAA;AAAE,mGAAA,UAAU,OAAA;AAC1B,0CAAuB;AAEhB,MAAM,UAAU,GAAG,UAAU,QAAgB,EAAE,QAAgB;IACpE,OAAO;QACL,aAAa,EAAE,SACb,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAC1H,EAAE;KACH,CAAA;AACH,CAAC,CAAA;AANY,QAAA,UAAU,cAMtB;AAEM,MAAM,GAAG,GAAG,UACjB,IAAY,EACZ,QAAgB,EAChB,QAAg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AAE,SAAS,CAAC,CAAA;IACnF,MAAM,YAAY,GAAG,IAAI,uCAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;IACvF,MAAM,UAAU,GAAG,IAAI,kCAAc,CACnC,IAAI,EACJ,OAAO,EACP,SAAS,EACT,UAAU,EACV,OAAO,EACP,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,CAAC,MAAM,CAAC,EACR,SAAS,CACV,CAAA;IACD,MAAM,UAAU,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;IACnF,MAAM,kBAAkB,GAAG,IAAI,mDAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAA;IAEvI,OAAO;QACL,SAAS;QACT,OAAO;QACP,OAAO;QACP,OAAO;QACP,aAAa;QACb,UAAU;QACV,kBAAkB;QAClB,SAAS;QACT,YAAY;QACZ,UAAU;QACV,oBAAoB;QACpB,WAAW;QACX,OAAO;QACP,UAAU;QACV,YAAY;QACZ,UAAU;QACV,kBAAkB;QAClB,UAAU;QACV,SAAS;QACT,eAAe;QACf,iBAAiB;QACjB,YAAY;QACZ,QAAQ;QACR,kBAAkB;KACnB,CAAA;AACH,CAAC,CAAA;AA9EY,QAAA,GAAG,OA8Ef","sourcesContent":["import { IccAgendaApi, IccAuthApi, IccEntityrefApi, IccGroupApi, IccInsuranceApi, IccPatientApi, IccPermissionApi } from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccDeviceApi } from '../icc-api/api/IccDeviceApi'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport {IccMaintenanceTaskXApi} from \"./icc-maintenance-task-x-api\"\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport { utils, UtilsClass } from './crypto/utils'\nexport * from './utils'\n\nexport const apiHeaders = function (username: string, password: string) {\n return {\n Authorization: `Basic ${\n typeof btoa !== 'undefined' ? btoa(`${username}:${password}`) : Buffer.from(`${username}:${password}`).toString('base64')\n }`,\n }\n}\n\nexport const Api = function (\n host: string,\n username: string,\n password: string,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\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 const headers = apiHeaders(username, password)\n const authApi = new IccAuthApi(host, headers, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, fetchImpl)\n const userApi = new IccUserXApi(host, headers, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, fetchImpl)\n const cryptoApi = new IccCryptoXApi(host, headers, healthcarePartyApi, new IccPatientApi(host, headers, fetchImpl), deviceApi, crypto)\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const groupApi = new IccGroupApi(host, headers)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, userApi, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, userApi, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, userApi, [], fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const patientApi = new IccPatientXApi(\n host,\n headers,\n cryptoApi,\n contactApi,\n formApi,\n healthcareElementApi,\n invoiceApi,\n documentApi,\n healthcarePartyApi,\n classificationApi,\n userApi,\n calendarItemApi,\n ['note'],\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(host, headers, cryptoApi, userApi, healthcarePartyApi, ['properties'], fetchImpl)\n\n return {\n cryptoApi,\n authApi,\n codeApi,\n userApi,\n permissionApi,\n patientApi,\n healthcarePartyApi,\n deviceApi,\n accessLogApi,\n contactApi,\n healthcareElementApi,\n documentApi,\n formApi,\n invoiceApi,\n insuranceApi,\n messageApi,\n entityReferenceApi,\n receiptApi,\n agendaApi,\n calendarItemApi,\n classificationApi,\n timetableApi,\n groupApi,\n maintenanceTaskApi\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqI;AACrI,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,yEAAkE;AAClE,uEAA+D;AAC/D,2DAAoD;AACpD,2DAAoD;AACpD,2DAAoD;AACpD,+DAAwD;AACxD,iEAAyD;AACzD,8DAA0D;AAC1D,qDAA8C;AAC9C,6EAAqE;AAErE,wDAAqC;AACrC,sDAAmC;AACnC,4DAAyC;AACzC,6DAA0C;AAC1C,mDAAgC;AAChC,sDAAmC;AACnC,qDAAkC;AAClC,0DAAuC;AACvC,uDAAoC;AACpC,mDAAgC;AAChC,sDAAmC;AACnC,uDAAoC;AACpC,sDAAmC;AACnC,sDAAmC;AACnC,sDAAmC;AACnC,mDAAgC;AAChC,yDAAsC;AACtC,sDAAmC;AACnC,0CAAuB;AAEhB,MAAM,UAAU,GAAG,UAAU,QAAgB,EAAE,QAAgB,EAAE,aAAsB,KAAK;IACjG,OAAO;QACL,aAAa,EAAE,SACb,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAA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AAa;YACb,UAAU;YACV,kBAAkB;YAClB,SAAS;YACT,YAAY;YACZ,UAAU;YACV,oBAAoB;YACpB,WAAW;YACX,OAAO;YACP,UAAU;YACV,YAAY;YACZ,UAAU;YACV,kBAAkB;YAClB,UAAU;YACV,SAAS;YACT,eAAe;YACf,iBAAiB;YACjB,YAAY;YACZ,QAAQ;YACR,kBAAkB;SACnB,CAAA;IACH,CAAC;CAAA,CAAA;AArFY,QAAA,GAAG,OAqFf","sourcesContent":["import { IccAgendaApi, IccAuthApi, IccEntityrefApi, IccGroupApi, IccInsuranceApi, IccPatientApi, IccPermissionApi } from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccDeviceApi } from '../icc-api/api/IccDeviceApi'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api'\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport * from './utils'\n\nexport const apiHeaders = function (username: string, password: string, forceBasic: boolean = false) {\n return {\n Authorization: `Basic ${\n typeof btoa !== 'undefined' ? btoa(`${username}:${password}`) : Buffer.from(`${username}:${password}`).toString('base64')\n }`,\n 'force-authentication': forceBasic ? 'true' : 'false',\n }\n}\n\nexport interface Apis {\n authApi: IccAuthApi\n codeApi: IccCodeXApi\n entityReferenceApi: IccEntityrefApi\n userApi: IccUserXApi\n permissionApi: IccPermissionApi\n healthcarePartyApi: IccHcpartyXApi\n deviceApi: IccDeviceApi\n cryptoApi: IccCryptoXApi\n accessLogApi: IccAccesslogXApi\n agendaApi: IccAgendaApi\n contactApi: IccContactXApi\n formApi: IccFormXApi\n groupApi: IccGroupApi\n invoiceApi: IccInvoiceXApi\n insuranceApi: IccInsuranceApi\n documentApi: IccDocumentXApi\n healthcareElementApi: IccHelementXApi\n classificationApi: IccClassificationXApi\n calendarItemApi: IccCalendarItemXApi\n receiptApi: IccReceiptXApi\n timetableApi: IccTimeTableXApi\n patientApi: IccPatientXApi\n messageApi: IccMessageXApi\n maintenanceTaskApi: IccMaintenanceTaskXApi\n}\n\nexport const Api = async function (\n host: string,\n username: string,\n password: string,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n forceBasic: boolean = false\n): Promise<Apis> {\n const headers = apiHeaders(username, password, forceBasic)\n const authApi = new IccAuthApi(host, headers, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, fetchImpl)\n const userApi = new IccUserXApi(host, headers, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, fetchImpl)\n const cryptoApi = new IccCryptoXApi(host, headers, healthcarePartyApi, new IccPatientApi(host, headers, fetchImpl), deviceApi, crypto)\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const groupApi = new IccGroupApi(host, headers)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, userApi, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, userApi, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, userApi, ['descr', 'note'], fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(host, headers, cryptoApi, userApi, ['details', 'title', 'patientId'], fetchImpl)\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const patientApi = new IccPatientXApi(\n host,\n headers,\n cryptoApi,\n contactApi,\n formApi,\n healthcareElementApi,\n invoiceApi,\n documentApi,\n healthcarePartyApi,\n classificationApi,\n userApi,\n calendarItemApi,\n ['note'],\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, userApi, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(host, headers, cryptoApi, userApi, healthcarePartyApi, ['properties'], fetchImpl)\n\n try {\n await authApi.login({ username, password })\n } catch (e) {\n console.error('Incorrect user and password used to instantiate Api, or network problem', e)\n }\n\n return {\n cryptoApi,\n authApi,\n codeApi,\n userApi,\n permissionApi,\n patientApi,\n healthcarePartyApi,\n deviceApi,\n accessLogApi,\n contactApi,\n healthcareElementApi,\n documentApi,\n formApi,\n invoiceApi,\n insuranceApi,\n messageApi,\n entityReferenceApi,\n receiptApi,\n agendaApi,\n calendarItemApi,\n classificationApi,\n timetableApi,\n groupApi,\n maintenanceTaskApi,\n }\n}\n"]}
|
|
@@ -134,7 +134,7 @@ function ua2hex(_ua) {
|
|
|
134
134
|
exports.ua2hex = ua2hex;
|
|
135
135
|
function b64_2uas(s) {
|
|
136
136
|
const sliceSize = 1024;
|
|
137
|
-
const byteCharacters = ModelHelper_1.a2b(s);
|
|
137
|
+
const byteCharacters = (0, ModelHelper_1.a2b)(s);
|
|
138
138
|
const bytesLength = byteCharacters.length;
|
|
139
139
|
const slicesCount = Math.ceil(bytesLength / sliceSize);
|
|
140
140
|
const byteArrays = new Array(slicesCount);
|
|
@@ -151,19 +151,19 @@ function b64_2uas(s) {
|
|
|
151
151
|
}
|
|
152
152
|
exports.b64_2uas = b64_2uas;
|
|
153
153
|
function ua2b64Url(ua) {
|
|
154
|
-
return ModelHelper_1.ua2b64(ua).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
154
|
+
return (0, ModelHelper_1.ua2b64)(ua).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
155
155
|
}
|
|
156
156
|
exports.ua2b64Url = ua2b64Url;
|
|
157
157
|
function b64Url2ua(ua) {
|
|
158
|
-
return ModelHelper_1.b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''));
|
|
158
|
+
return (0, ModelHelper_1.b64_2ua)(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''));
|
|
159
159
|
}
|
|
160
160
|
exports.b64Url2ua = b64Url2ua;
|
|
161
161
|
function hex2string(hexStr) {
|
|
162
|
-
return ModelHelper_1.ua2string(hex2ua(hexStr));
|
|
162
|
+
return (0, ModelHelper_1.ua2string)(hex2ua(hexStr));
|
|
163
163
|
}
|
|
164
164
|
exports.hex2string = hex2string;
|
|
165
165
|
function string2hex(text) {
|
|
166
|
-
return ua2hex(ModelHelper_1.string2ua(text));
|
|
166
|
+
return ua2hex((0, ModelHelper_1.string2ua)(text));
|
|
167
167
|
}
|
|
168
168
|
exports.string2hex = string2hex;
|
|
169
169
|
//# sourceMappingURL=binary-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAAA,iEAA4H;AACnH,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,sFADA,mBAAK,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,uFADA,oBAAM,OACA;AAAE,oFADA,iBAAG,OACA;AAAE,oFADA,iBAAG,OACA;AAEnF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACjF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAEjF,SAAgB,QAAQ,CAAC,GAAW;IAClC,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;KAC/B;IAED,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,KAAK,I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} from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAAA,iEAA4H;AACnH,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,sFADA,mBAAK,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,uFADA,oBAAM,OACA;AAAE,oFADA,iBAAG,OACA;AAAE,oFADA,iBAAG,OACA;AAEnF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACjF,MAAM,WAAW,GAAG,O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AC,EAAE,CAAC,CAAC,CAAA;AAC5I,CAAC;AAFD,8BAEC;AAED,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAA,uBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,MAAM,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,gCAEC","sourcesContent":["import { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b } from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare function notConcurrent<T>(concurrencyMap: {
|
|
2
|
+
[key: string]: PromiseLike<T>;
|
|
3
|
+
}, key: string, proc: () => PromiseLike<T>): PromiseLike<T>;
|
|
4
|
+
export declare function jwk2pkcs8(jwk: any): string;
|
|
5
|
+
export declare function jwk2spki(jwk: any): string;
|
|
6
|
+
export declare function spkiToJwk(buf: Uint8Array): {
|
|
7
|
+
kty: string;
|
|
8
|
+
alg: string;
|
|
9
|
+
n: string;
|
|
10
|
+
e: string;
|
|
11
|
+
ext: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function pkcs8ToJwk(buf: Uint8Array | ArrayBuffer): {
|
|
14
|
+
kty: string;
|
|
15
|
+
n: string;
|
|
16
|
+
e: string;
|
|
17
|
+
d: string;
|
|
18
|
+
p: string;
|
|
19
|
+
q: string;
|
|
20
|
+
dp: string;
|
|
21
|
+
dq: string;
|
|
22
|
+
qi: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Provide a view over the given Uint8Array where any trailing null bytes at
|
|
26
|
+
* the end are truncated.
|
|
27
|
+
*
|
|
28
|
+
* This can be used to ignore null bytes at the end of a padded UTF-8 string
|
|
29
|
+
* without needing to copy that string, assuming code point U+0000 is encoded
|
|
30
|
+
* in one null byte according to standards rather than in a multi-byte
|
|
31
|
+
* overlong form.
|
|
32
|
+
*/
|
|
33
|
+
export declare function truncateTrailingNulls(a: Uint8Array): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param buffer1 {Uint8Array}
|
|
37
|
+
* @param buffer2{ Uint8Array}
|
|
38
|
+
* @returns {ArrayBuffer}
|
|
39
|
+
*/
|
|
40
|
+
export declare function appendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer;
|
|
41
|
+
export declare function after(d1: number | null | undefined, d2: number | null | undefined): boolean;
|
|
42
|
+
export declare function before(d1: number | null | undefined, d2: number | null | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Encrypt object graph recursively
|
|
45
|
+
*
|
|
46
|
+
* @param obj the object to encrypt
|
|
47
|
+
* @param cryptor the cryptor function (returns a promise)
|
|
48
|
+
* @param keys the keys to be crypted: ex for a Patient ['note', 'addresses.*.["street", "houseNumber", "telecoms.*.telecomNumber"]']
|
|
49
|
+
*/
|
|
50
|
+
export declare function crypt(obj: any, cryptor: (obj: {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
}) => Promise<ArrayBuffer>, keys: Array<string>): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Decrypt object graph recursively
|
|
55
|
+
*
|
|
56
|
+
* @param obj the object to encrypt
|
|
57
|
+
* @param decryptor the decryptor function (returns a promise)
|
|
58
|
+
*/
|
|
59
|
+
export declare function decrypt(obj: any, decryptor: (obj: Uint8Array) => Promise<{
|
|
60
|
+
[key: string]: string;
|
|
61
|
+
}>): Promise<any>;
|
|
@@ -0,0 +1,245 @@
|
|
|
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.decrypt = exports.crypt = exports.before = exports.after = exports.appendBuffer = exports.truncateTrailingNulls = exports.pkcs8ToJwk = exports.spkiToJwk = exports.jwk2spki = exports.jwk2pkcs8 = exports.notConcurrent = void 0;
|
|
13
|
+
const mm = require("moment");
|
|
14
|
+
const _ = require("lodash");
|
|
15
|
+
const binary_utils_1 = require("../utils/binary-utils");
|
|
16
|
+
const asn1_packer_1 = require("./asn1-packer");
|
|
17
|
+
const asn1_parser_1 = require("./asn1-parser");
|
|
18
|
+
function notConcurrent(concurrencyMap, key, proc) {
|
|
19
|
+
const inFlight = concurrencyMap[key];
|
|
20
|
+
if (!inFlight) {
|
|
21
|
+
return (concurrencyMap[key] = (() => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
return yield proc();
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
delete concurrencyMap[key];
|
|
27
|
+
}
|
|
28
|
+
}))());
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return concurrencyMap[key].then(() => notConcurrent(concurrencyMap, key, proc));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.notConcurrent = notConcurrent;
|
|
35
|
+
function jwk2pkcs8(jwk) {
|
|
36
|
+
return (0, asn1_packer_1.pack)([
|
|
37
|
+
0x30,
|
|
38
|
+
[
|
|
39
|
+
[0x02, '00'],
|
|
40
|
+
[0x30, [[0x06, '2a864886f70d010101'], [0x05]]],
|
|
41
|
+
[
|
|
42
|
+
0x04,
|
|
43
|
+
[
|
|
44
|
+
[
|
|
45
|
+
0x30,
|
|
46
|
+
[
|
|
47
|
+
[0x02, '00'],
|
|
48
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.n))],
|
|
49
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.e))],
|
|
50
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.d))],
|
|
51
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.p))],
|
|
52
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.q))],
|
|
53
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dp))],
|
|
54
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.dq))],
|
|
55
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.qi))],
|
|
56
|
+
],
|
|
57
|
+
],
|
|
58
|
+
],
|
|
59
|
+
],
|
|
60
|
+
],
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
exports.jwk2pkcs8 = jwk2pkcs8;
|
|
64
|
+
function jwk2spki(jwk) {
|
|
65
|
+
return (0, asn1_packer_1.pack)([
|
|
66
|
+
0x30,
|
|
67
|
+
[
|
|
68
|
+
[0x30, [[0x06, '2a864886f70d010101'], [0x05]]],
|
|
69
|
+
[
|
|
70
|
+
0x03,
|
|
71
|
+
[
|
|
72
|
+
[
|
|
73
|
+
0x30,
|
|
74
|
+
[
|
|
75
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.n))],
|
|
76
|
+
[0x02, (0, binary_utils_1.ua2hex)((0, binary_utils_1.b64Url2ua)(jwk.e))],
|
|
77
|
+
],
|
|
78
|
+
],
|
|
79
|
+
],
|
|
80
|
+
],
|
|
81
|
+
],
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
exports.jwk2spki = jwk2spki;
|
|
85
|
+
function spkiToJwk(buf) {
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
87
|
+
const asn1 = (0, asn1_parser_1.parseAsn1)(new Uint8Array(buf));
|
|
88
|
+
var modulus = undefined;
|
|
89
|
+
var exponent = undefined;
|
|
90
|
+
if (asn1.type === 0x30 &&
|
|
91
|
+
((_b = (_a = asn1.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.type) === 0x30 &&
|
|
92
|
+
((_f = (_e = (_d = (_c = asn1.children) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.children) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.type) === 0x06 &&
|
|
93
|
+
(0, binary_utils_1.ua2hex)((_l = (_k = (_j = (_h = (_g = asn1.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : new Uint8Array(0)) === '2a864886f70d010101') {
|
|
94
|
+
modulus = (_s = (_r = (_q = (_p = (_o = (_m = asn1.children) === null || _m === void 0 ? void 0 : _m[1]) === null || _o === void 0 ? void 0 : _o.children) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.children) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.value;
|
|
95
|
+
exponent = (_y = (_x = (_w = (_v = (_u = (_t = asn1.children) === null || _t === void 0 ? void 0 : _t[1]) === null || _u === void 0 ? void 0 : _u.children) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.children) === null || _x === void 0 ? void 0 : _x[1]) === null || _y === void 0 ? void 0 : _y.value;
|
|
96
|
+
}
|
|
97
|
+
else if (asn1.type === 0x30 && ((_0 = (_z = asn1.children) === null || _z === void 0 ? void 0 : _z[0]) === null || _0 === void 0 ? void 0 : _0.type) === 0x02 && ((_2 = (_1 = asn1.children) === null || _1 === void 0 ? void 0 : _1[1]) === null || _2 === void 0 ? void 0 : _2.type) === 0x02) {
|
|
98
|
+
modulus = (_4 = (_3 = asn1.children) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.value;
|
|
99
|
+
exponent = (_6 = (_5 = asn1.children) === null || _5 === void 0 ? void 0 : _5[1]) === null || _6 === void 0 ? void 0 : _6.value;
|
|
100
|
+
}
|
|
101
|
+
if (!modulus || !exponent) {
|
|
102
|
+
throw new Error('Invalid spki format');
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
kty: 'RSA',
|
|
106
|
+
alg: 'RSA-OAEP',
|
|
107
|
+
ext: true,
|
|
108
|
+
n: (0, binary_utils_1.ua2b64Url)(minimalRep(modulus)),
|
|
109
|
+
e: (0, binary_utils_1.ua2b64Url)(minimalRep(exponent)),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
exports.spkiToJwk = spkiToJwk;
|
|
113
|
+
function pkcs8ToJwk(buf) {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
const parsed = (0, asn1_parser_1.parseAsn1)(new Uint8Array(buf));
|
|
116
|
+
const seq = ((_a = parsed.children) === null || _a === void 0 ? void 0 : _a.length) === 3 && parsed.children[2].type === 0x04 && ((_b = parsed.children[2].children) === null || _b === void 0 ? void 0 : _b.length) === 1
|
|
117
|
+
? parsed.children[2].children[0]
|
|
118
|
+
: parsed;
|
|
119
|
+
return {
|
|
120
|
+
kty: 'RSA',
|
|
121
|
+
n: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[1].value)),
|
|
122
|
+
e: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[2].value)),
|
|
123
|
+
d: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[3].value)),
|
|
124
|
+
p: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[4].value)),
|
|
125
|
+
q: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[5].value)),
|
|
126
|
+
dp: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[6].value)),
|
|
127
|
+
dq: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[7].value)),
|
|
128
|
+
qi: (0, binary_utils_1.ua2b64Url)(minimalRep(seq.children[8].value)),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
exports.pkcs8ToJwk = pkcs8ToJwk;
|
|
132
|
+
function minimalRep(b) {
|
|
133
|
+
let i = 0;
|
|
134
|
+
while (b[i] === 0) {
|
|
135
|
+
i++;
|
|
136
|
+
}
|
|
137
|
+
return b.slice(i);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Provide a view over the given Uint8Array where any trailing null bytes at
|
|
141
|
+
* the end are truncated.
|
|
142
|
+
*
|
|
143
|
+
* This can be used to ignore null bytes at the end of a padded UTF-8 string
|
|
144
|
+
* without needing to copy that string, assuming code point U+0000 is encoded
|
|
145
|
+
* in one null byte according to standards rather than in a multi-byte
|
|
146
|
+
* overlong form.
|
|
147
|
+
*/
|
|
148
|
+
function truncateTrailingNulls(a) {
|
|
149
|
+
let end = a.byteLength - 1;
|
|
150
|
+
while (a[end] === 0 && end >= 0) {
|
|
151
|
+
end--;
|
|
152
|
+
}
|
|
153
|
+
// end is now either the last non-null position in a or -1; in the latter
|
|
154
|
+
// case the returned array will have length 0.
|
|
155
|
+
return a.subarray(0, end + 1);
|
|
156
|
+
}
|
|
157
|
+
exports.truncateTrailingNulls = truncateTrailingNulls;
|
|
158
|
+
/**
|
|
159
|
+
*
|
|
160
|
+
* @param buffer1 {Uint8Array}
|
|
161
|
+
* @param buffer2{ Uint8Array}
|
|
162
|
+
* @returns {ArrayBuffer}
|
|
163
|
+
*/
|
|
164
|
+
function appendBuffer(buffer1, buffer2) {
|
|
165
|
+
const tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
|
|
166
|
+
tmp.set(new Uint8Array(buffer1), 0);
|
|
167
|
+
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
|
|
168
|
+
return tmp.buffer;
|
|
169
|
+
}
|
|
170
|
+
exports.appendBuffer = appendBuffer;
|
|
171
|
+
//Convenience methods for dates management
|
|
172
|
+
function after(d1, d2) {
|
|
173
|
+
return d1 === null || d2 === null || d1 === undefined || d2 === undefined || moment(d1).isAfter(moment(d2));
|
|
174
|
+
}
|
|
175
|
+
exports.after = after;
|
|
176
|
+
function before(d1, d2) {
|
|
177
|
+
return d1 === null || d2 === null || d1 === undefined || d2 === undefined || moment(d1).isBefore(moment(d2));
|
|
178
|
+
}
|
|
179
|
+
exports.before = before;
|
|
180
|
+
function moment(epochOrLongCalendar) {
|
|
181
|
+
if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {
|
|
185
|
+
return mm('' + epochOrLongCalendar, 'YYYYMMDD');
|
|
186
|
+
}
|
|
187
|
+
else if (epochOrLongCalendar >= 18000101000000) {
|
|
188
|
+
return mm('' + epochOrLongCalendar, 'YYYYMMDDHHmmss');
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return mm(epochOrLongCalendar);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Encrypt object graph recursively
|
|
196
|
+
*
|
|
197
|
+
* @param obj the object to encrypt
|
|
198
|
+
* @param cryptor the cryptor function (returns a promise)
|
|
199
|
+
* @param keys the keys to be crypted: ex for a Patient ['note', 'addresses.*.["street", "houseNumber", "telecoms.*.telecomNumber"]']
|
|
200
|
+
*/
|
|
201
|
+
function crypt(obj, cryptor, keys) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const subObj = _.pick(obj, keys.filter((k) => !k.includes('*')));
|
|
204
|
+
obj.encryptedSelf = (0, binary_utils_1.b2a)((0, binary_utils_1.ua2string)(yield cryptor(subObj)));
|
|
205
|
+
Object.keys(subObj).forEach((k) => delete obj[k]);
|
|
206
|
+
yield keys
|
|
207
|
+
.filter((k) => k.includes('*'))
|
|
208
|
+
.reduce((prev, k) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
yield prev;
|
|
210
|
+
const k1 = k.split('.*.')[0];
|
|
211
|
+
const k2 = k.substr(k1.length + 3);
|
|
212
|
+
const mapped = yield Promise.all((_.get(obj, k1) || []).map((so) => crypt(so, cryptor, k2.startsWith('[') ? JSON.parse(k2) : [k2])));
|
|
213
|
+
_.set(obj, k1, mapped);
|
|
214
|
+
}), Promise.resolve());
|
|
215
|
+
return obj;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
exports.crypt = crypt;
|
|
219
|
+
/**
|
|
220
|
+
* Decrypt object graph recursively
|
|
221
|
+
*
|
|
222
|
+
* @param obj the object to encrypt
|
|
223
|
+
* @param decryptor the decryptor function (returns a promise)
|
|
224
|
+
*/
|
|
225
|
+
function decrypt(obj, decryptor) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
yield Object.keys(obj).reduce((prev, k) => __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
yield prev;
|
|
229
|
+
if (Array.isArray(obj[k])) {
|
|
230
|
+
yield obj[k]
|
|
231
|
+
.filter((o) => typeof o === 'object' && o !== null)
|
|
232
|
+
.reduce((prev, so) => __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
yield prev;
|
|
234
|
+
yield decrypt(so, decryptor);
|
|
235
|
+
}), Promise.resolve());
|
|
236
|
+
}
|
|
237
|
+
}), Promise.resolve());
|
|
238
|
+
if (obj.encryptedSelf) {
|
|
239
|
+
Object.assign(obj, yield decryptor((0, binary_utils_1.string2ua)((0, binary_utils_1.a2b)(obj.encryptedSelf))));
|
|
240
|
+
}
|
|
241
|
+
return obj;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
exports.decrypt = decrypt;
|
|
245
|
+
//# sourceMappingURL=crypto-utils.js.map
|