@icure/api 6.0.6 → 6.2.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.
@@ -1,4 +1,4 @@
1
- import { IccAgendaApi, IccAuthApi, IccEntityrefApi, IccGroupApi, IccInsuranceApi, IccPermissionApi } from '../icc-api';
1
+ import { IccAgendaApi, IccAuthApi, IccCalendarItemTypeApi, IccEntityrefApi, IccGroupApi, IccInsuranceApi, IccMedicallocationApi, IccPermissionApi } 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';
@@ -46,6 +46,8 @@ export { KeyStorageImpl } from './storage/KeyStorageImpl';
46
46
  export interface Apis {
47
47
  authApi: IccAuthApi;
48
48
  codeApi: IccCodeXApi;
49
+ calendarItemTypeApi: IccCalendarItemTypeApi;
50
+ medicalLocationApi: IccMedicallocationApi;
49
51
  entityReferenceApi: IccEntityrefApi;
50
52
  userApi: IccUserXApi;
51
53
  permissionApi: IccPermissionApi;
@@ -99,6 +99,8 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
99
99
  const contactApi = new icc_contact_x_api_1.IccContactXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
100
100
  const formApi = new icc_form_x_api_1.IccFormXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
101
101
  const groupApi = new icc_api_1.IccGroupApi(host, headers, authenticationProvider);
102
+ const medicalLocationApi = new icc_api_1.IccMedicallocationApi(host, headers, authenticationProvider);
103
+ const calendarItemTypeApi = new icc_api_1.IccCalendarItemTypeApi(host, headers, authenticationProvider);
102
104
  const invoiceApi = new icc_invoice_x_api_1.IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl);
103
105
  const insuranceApi = new icc_api_1.IccInsuranceApi(host, headers, authenticationProvider, fetchImpl);
104
106
  const documentApi = new icc_document_x_api_1.IccDocumentXApi(host, headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl);
@@ -127,6 +129,8 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
127
129
  cryptoApi,
128
130
  authApi,
129
131
  codeApi,
132
+ calendarItemTypeApi,
133
+ medicalLocationApi,
130
134
  userApi,
131
135
  permissionApi,
132
136
  patientApi,
@@ -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,6EAAqE;AACrE,iEAAyD;AACzD,mCAA+B;AAG/B,iEAA6D;AAC7D,6DAAyD;AACzD,0EAAqI;AAErI,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;AAEvB,+DAA6D;AAApD,oHAAA,gBAAgB,OAAA;AAEzB,2DAAyD;AAAhD,gHAAA,cAAc,OAAA;AA8BhB,MAAM,GAAG,GAAG,UACjB,IAAY,EACZ,QAAgB,EAChB,QAAgB,EAChB,SAAiB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC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ACf,CAAC,MAAM,CAAC,EACR,sBAAsB,EACtB,SAAS,CACV,CAAA;QACD,MAAM,UAAU,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QAChH,MAAM,kBAAkB,GAAG,IAAI,mDAAsB,CACnD,IAAI,EACJ,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,CAAC,YAAY,CAAC,EACd,sBAAsB,EACtB,SAAS,CACV,CAAA;QAED,IAAI,SAAS,EAAE;YACb,IAAI,QAAQ,IAAI,SAAS,IAAI,QAAQ,IAAI,SAAS,EAAE;gBAClD,IAAI;oBACF,MAAM,IAAA,aAAK,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;iBACvE;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,yEAAyE,EAAE,CAAC,CAAC,CAAA;iBAC5F;aACF;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;SACnC;QAED,OAAO;YACL,SAAS;YACT,OAAO;YACP,OAAO;YACP,OAAO;YACP,aAAa;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;YAClB,YAAY;SACb,CAAA;IACH,CAAC;CAAA,CAAA;AApIY,QAAA,GAAG,OAoIf","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'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { retry } from './utils'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport { BasicAuthenticationProvider, EnsembleAuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\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'\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\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 dataOwnerApi: IccDataOwnerXApi\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 = false,\n autoLogin = false,\n storage?: StorageFacade<string>,\n keyStorage?: KeyStorageFacade\n): Promise<Apis> {\n const _storage = storage || new LocalStorageImpl()\n const _keyStorage = keyStorage || new KeyStorageImpl(_storage)\n\n // The AuthenticationProvider needs a AuthApi without authentication because it will only call methods without authentication\n const headers = {}\n const authenticationProvider = forceBasic\n ? new BasicAuthenticationProvider(username, password)\n : new EnsembleAuthenticationProvider(new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl), username, password)\n\n // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)\n const authApi = new IccAuthApi(host, headers, authenticationProvider, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, headers, authenticationProvider, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, authenticationProvider, fetchImpl)\n const cryptoApi = new IccCryptoXApi(\n host,\n headers,\n healthcarePartyApi,\n new IccPatientApi(host, headers, authenticationProvider, fetchImpl),\n deviceApi,\n crypto,\n _storage,\n _keyStorage\n )\n const dataOwnerApi = new IccDataOwnerXApi(cryptoApi, new IccPatientApi(host, headers, authenticationProvider, fetchImpl))\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, authenticationProvider, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, headers, authenticationProvider)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, authenticationProvider, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, dataOwnerApi, ['descr', 'note'], authenticationProvider, fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(\n host,\n headers,\n cryptoApi,\n dataOwnerApi,\n ['details', 'title', 'patientId'],\n authenticationProvider,\n fetchImpl\n )\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, 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 dataOwnerApi,\n calendarItemApi,\n ['note'],\n authenticationProvider,\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n headers,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n ['properties'],\n authenticationProvider,\n fetchImpl\n )\n\n if (autoLogin) {\n if (username != undefined && password != undefined) {\n try {\n await retry(() => authApi.login({ username, password }), 3, 1000, 1.5)\n } catch (e) {\n console.error('Incorrect user and password used to instantiate Api, or network problem', e)\n }\n }\n } else {\n console.info('Auto login skipped')\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 dataOwnerApi,\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAUmB;AACnB,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDA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AAY,CAAC,EACd,sBAAsB,EACtB,SAAS,CACV,CAAA;QAED,IAAI,SAAS,EAAE;YACb,IAAI,QAAQ,IAAI,SAAS,IAAI,QAAQ,IAAI,SAAS,EAAE;gBAClD,IAAI;oBACF,MAAM,IAAA,aAAK,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;iBACvE;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,yEAAyE,EAAE,CAAC,CAAC,CAAA;iBAC5F;aACF;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;SACnC;QAED,OAAO;YACL,SAAS;YACT,OAAO;YACP,OAAO;YACP,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,aAAa;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;YAClB,YAAY;SACb,CAAA;IACH,CAAC;CAAA,CAAA;AAxIY,QAAA,GAAG,OAwIf","sourcesContent":["import {\n IccAgendaApi,\n IccAuthApi,\n IccCalendarItemTypeApi,\n IccEntityrefApi,\n IccGroupApi,\n IccInsuranceApi,\n IccMedicallocationApi,\n IccPatientApi,\n IccPermissionApi,\n} 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'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { retry } from './utils'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport { BasicAuthenticationProvider, EnsembleAuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\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'\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\n\nexport interface Apis {\n authApi: IccAuthApi\n codeApi: IccCodeXApi\n calendarItemTypeApi: IccCalendarItemTypeApi\n medicalLocationApi: IccMedicallocationApi\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 dataOwnerApi: IccDataOwnerXApi\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 = false,\n autoLogin = false,\n storage?: StorageFacade<string>,\n keyStorage?: KeyStorageFacade\n): Promise<Apis> {\n const _storage = storage || new LocalStorageImpl()\n const _keyStorage = keyStorage || new KeyStorageImpl(_storage)\n\n // The AuthenticationProvider needs a AuthApi without authentication because it will only call methods without authentication\n const headers = {}\n const authenticationProvider = forceBasic\n ? new BasicAuthenticationProvider(username, password)\n : new EnsembleAuthenticationProvider(new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl), username, password)\n\n // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)\n const authApi = new IccAuthApi(host, headers, authenticationProvider, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, headers, authenticationProvider, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, authenticationProvider, fetchImpl)\n const cryptoApi = new IccCryptoXApi(\n host,\n headers,\n healthcarePartyApi,\n new IccPatientApi(host, headers, authenticationProvider, fetchImpl),\n deviceApi,\n crypto,\n _storage,\n _keyStorage\n )\n const dataOwnerApi = new IccDataOwnerXApi(cryptoApi, new IccPatientApi(host, headers, authenticationProvider, fetchImpl))\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, authenticationProvider, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, headers, authenticationProvider)\n const medicalLocationApi = new IccMedicallocationApi(host, headers, authenticationProvider)\n const calendarItemTypeApi = new IccCalendarItemTypeApi(host, headers, authenticationProvider)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, authenticationProvider, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, dataOwnerApi, ['descr', 'note'], authenticationProvider, fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(\n host,\n headers,\n cryptoApi,\n dataOwnerApi,\n ['details', 'title', 'patientId'],\n authenticationProvider,\n fetchImpl\n )\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, 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 dataOwnerApi,\n calendarItemApi,\n ['note'],\n authenticationProvider,\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n headers,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n ['properties'],\n authenticationProvider,\n fetchImpl\n )\n\n if (autoLogin) {\n if (username != undefined && password != undefined) {\n try {\n await retry(() => authApi.login({ username, password }), 3, 1000, 1.5)\n } catch (e) {\n console.error('Incorrect user and password used to instantiate Api, or network problem', e)\n }\n }\n } else {\n console.info('Auto login skipped')\n }\n\n return {\n cryptoApi,\n authApi,\n codeApi,\n calendarItemTypeApi,\n medicalLocationApi,\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 dataOwnerApi,\n }\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare function packOther(...args: string[]): string;
2
- export declare type Asn1Item = number | string | Asn1Item[];
2
+ export type Asn1Item = number | string | Asn1Item[];
3
3
  export declare function pack(arr: Asn1Item[]): string;
@@ -1,4 +1,4 @@
1
- export declare type Asn1 = {
1
+ export type Asn1 = {
2
2
  type: number;
3
3
  lengthSize: number;
4
4
  length: number;
@@ -87,7 +87,7 @@ function phoneNumberFormat(phoneNumber) {
87
87
  // The number is not valid, so we leave the input string as-is.
88
88
  return phoneNumber;
89
89
  }
90
- return (0, libphonenumber_js_1.formatNumber)(parsedPhoneNumber, 'International');
90
+ return (0, libphonenumber_js_1.formatNumber)(parsedPhoneNumber, 'INTERNATIONAL');
91
91
  }
92
92
  exports.phoneNumberFormat = phoneNumberFormat;
93
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"formatting-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/formatting-util.ts"],"names":[],"mappings":";;;AAAA,yDAA0F;AAE1F,iCAAgC;AAChC,4BAA2B;AAG3B,6BAA6B;AAC7B,MAAM,eAAe,GAAG,IAAI,CAAA;AAEf,QAAA,WAAW,GAAG,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAAA;AAC9D,QAAA,UAAU,GAAG,IAAI,MAAM,CAAC,4CAA4C,CAAC,CAAA;AACrE,QAAA,UAAU,GAAG,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAAA;AAE1E,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;IACpE,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;CACvE,CAAA;AAED,kDAAkD;AAClD,SAAgB,WAAW,CAAC,IAAY;IACtC,gDAAgD;IAChD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA,CAAC,+CAA+C;IAC3F,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE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EAAE;QACrD,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,mBAAmB,IAAI,QAAQ,IAAI,mBAAmB,GAAG,QAAQ,EAAE;QACrE,OAAO,MAAM,CAAC,EAAE,GAAG,mBAAmB,EAAE,UAAU,CAAC,CAAA;KACpD;SAAM,IAAI,mBAAmB,IAAI,cAAc,EAAE;QAChD,OAAO,MAAM,CAAC,EAAE,GAAG,mBAAmB,EAAE,gBAAgB,CAAC,CAAA;KAC1D;SAAM;QACL,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAA;KACnC;AACH,CAAC;AAXD,4BAWC","sourcesContent":["import { parseNumber, formatNumber, isValidNumber, ParsedNumber } from 'libphonenumber-js'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport { Moment } from 'moment'\n\n// TODO: move this to env.js?\nconst DEFAULT_COUNTRY = 'BE'\n\nexport const nihiiRegExp = new RegExp('^(\\\\d{1})(\\\\d{5})(\\\\d{2})(\\\\d{3})$')\nexport const ssinRegExp = new RegExp('^(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})$')\nexport const ibanRegExp = new RegExp('^(\\\\d{4})(\\\\d{4})(\\\\d{4})(\\\\d{4})$')\n\nconst patterns = {\n IBAN: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n IBANBE: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n}\n\n//http://ht5ifv.serprest.pt/extensions/tools/IBAN/\nexport function isValidIBAN(iban: string) {\n //This function check if the checksum if correct\n iban = iban.replace(/^(.{4})(.*)$/, '$2$1') //Move the first 4 chars from left to the right\n const fun = (e: string) => (e.charCodeAt(0) - 'A'.charCodeAt(0) + 10).toString()\n iban = iban.replace(/[A-Z]/g, fun) //Convert A-Z to 10-25\n let $sum = 0\n let $ei = 1 //First exponent\n for (let $i = iban.length - 1; $i >= 0; $i--) {\n $sum += $ei * parseInt(iban.charAt($i), 10) //multiply the digit by it's exponent\n $ei = ($ei * 10) % 97 //compute next base 10 exponent in modulus 97\n }\n return $sum % 97 === 1\n}\n\nexport function ibanValidate(iban: string) {\n if (iban.startsWith('BE')) {\n return patterns.IBANBE(iban)\n } else {\n return patterns.IBAN(iban)\n }\n}\n\nexport function ibanFormat(iban: string): string {\n return iban.replace(ibanRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiFormat(nihii: string): string {\n return nihii.replace(nihiiRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiValidate(nihii: string): boolean {\n return !!nihii.match(nihiiRegExp)\n}\n\nexport function ssinFormat(ssin: string): string {\n return ssin.replace(ssinRegExp, '$1 $2 $3 $4 $5')\n}\n\nexport function ssinValidate(ssin: string): boolean {\n return !!ssin.match(ssinRegExp)\n}\n\n/* Alternate lib free version\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return (\n !!phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/) ||\n !!phoneNumber.match(/(0[1-9][0-9]*)([- /.]*([0-9]+))+/)\n )\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n let match = phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/)\n if (match) {\n return `+${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n match = phoneNumber.match(/0([1-9][0-9]*)([- /.]*([0-9]+))+/)\n if (match) {\n return `+32 ${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n return phoneNumber\n}\n*/\n\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return isValidNumber(phoneNumber)\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n const parsedPhoneNumber = parseNumber(phoneNumber, DEFAULT_COUNTRY) as ParsedNumber\n if (_.isEmpty(parsedPhoneNumber)) {\n // The number is not valid, so we leave the input string as-is.\n return phoneNumber\n }\n return formatNumber(parsedPhoneNumber, 'International')\n}\n\n/**\n * Converts a backend date number (e.g., patient birth date) into a Date object.\n * @param dateNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @throws Error if it is impossible to create a date from the number, other if dateNumber is negative.\n * @see #dateEncode\n * @see #timeDecode\n */\nexport function dateDecode(dateNumber: number): Date | undefined {\n if (!dateNumber) {\n return undefined\n }\n\n if (dateNumber < 0) {\n throw new Error(\"We don't decode negative dates. Please make sure you have valid data.\")\n }\n const dateNumberStr: string = _.padStart(dateNumber.toString(), 8, '19700101')\n if (dateNumberStr.length > 8) {\n if (dateNumberStr.endsWith('000000')) {\n return dateNumber ? moment(dateNumberStr, 'YYYYMMDD000000').toDate() : undefined\n }\n\n throw Error(\"Decoded date is over year 9999. We can't format it properly.\")\n }\n return dateNumber ? moment(dateNumberStr, 'YYYYMMDD').toDate() : undefined\n}\n\n/**\n * Converts a backend time number (e.g., health element openingDate) into a Date object.\n * @param timeNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @see #timeEncode\n * @see #dateDecode\n */\nexport function timeDecode(timeNumber: number): Date | undefined {\n return timeNumber ? moment(timeNumber.toString(), 'YYYYMMDDHHmmss').toDate() : undefined\n}\n\n/**\n * Encodes a Date object into a backend date number (e.g., patient birth date).\n * @param date a Date object\n * @return a YYYYMMDD date number for the backend\n * @see #dateDecode\n * @see #timeEncode\n */\nexport function dateEncode(date: Date): number | undefined {\n const dateStr = _.padStart(moment(date).format('YYYYMMDD'), 8, '19700101')\n // date is null if the field is not set\n return date ? Number(dateStr) : undefined\n}\n\n/**\n * Encodes a Date object into a backend time number (e.g., health element openingDate).\n * @param date a Date object\n * @return a YYYYMMDDHHmmss date number for the backend\n * @see #timeDecode\n * @see #dateEncode\n */\nexport function timeEncode(date: Date): number | undefined {\n return date ? Number(moment(date).format('YYYYMMDDHHmmss')) : undefined\n}\n\n/**\n * Formats a value and a physical unit into text.\n * @param value the numerical or string value to encode\n * @param unit the unit represented as a string (an empty string is also supported)\n */\nexport function unit(value: number | string, unit: string | null): string {\n unit = unit || ''\n let separator: string\n if (!unit || unit.startsWith('°')) {\n separator = ''\n } else {\n // including '%'\n separator = '\\xa0'\n }\n return value + separator + unit\n}\n\n/**\n * 0.1 + 0.2 = 0.30000000000000004. Use this function to be better at maths.\n * @param a number\n * @return the rounded number, two after the comma\n */\nexport function amount(value: number): number {\n return Number((value || 0).toFixed(2))\n}\n\n/**\n * A simple formatter to keep the logic across the app.\n * Input: 2.1 ; Output: 2.10€\n */\nexport function money(value: number): string {\n return [(value || 0).toFixed(2), '€'].join('')\n}\n\n/**\n * Transform a dictionary to a url params.\n * From { key1: value1, key2: value2, ... } returns key1=value1&key2=value2&...=...\n */\nexport function toUrlParams(params: { [key: string]: string }): string {\n return _.filter(_.map(params, (value, key) => (value ? key + '=' + value : undefined))).join('&')\n}\n\nexport function personName(person: { firstName?: string; lastName?: string }): string {\n return `${person.firstName || ''} ${person.lastName || ''}`.trim()\n}\n\nexport function personNameAbbrev(person: { firstName?: string; lastName?: string }): string {\n const firstName = person.firstName ? person.firstName[0] + '.' : undefined\n return personName({ ...person, firstName })\n}\n\nexport function toMoment(epochOrLongCalendar: number): Moment | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDD')\n } else if (epochOrLongCalendar >= 18000101000000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDDhhmmss')\n } else {\n return moment(epochOrLongCalendar)\n }\n}\n"]}
1
+ {"version":3,"file":"formatting-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/formatting-util.ts"],"names":[],"mappings":";;;AAAA,yDAA0F;AAE1F,iCAAgC;AAChC,4BAA2B;AAG3B,6BAA6B;AAC7B,MAAM,eAAe,GAAG,IAAI,CAAA;AAEf,QAAA,WAAW,GAAG,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAAA;AAC9D,QAAA,UAAU,GAAG,IAAI,MAAM,CAAC,4CAA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AAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACnG,CAAC;AAFD,kCAEC;AAED,SAAgB,UAAU,CAAC,MAAiD;IAC1E,OAAO,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;AACpE,CAAC;AAFD,gCAEC;AAED,SAAgB,gBAAgB,CAAC,MAAiD;IAChF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1E,OAAO,UAAU,iCAAM,MAAM,KAAE,SAAS,IAAG,CAAA;AAC7C,CAAC;AAHD,4CAGC;AAED,SAAgB,QAAQ,CAAC,mBAA2B;IAClD,IAAI,CAAC,mBAAmB,IAAI,mBAAmB,KAAK,CAAC,EAAE;QACrD,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,mBAAmB,IAAI,QAAQ,IAAI,mBAAmB,GAAG,QAAQ,EAAE;QACrE,OAAO,MAAM,CAAC,EAAE,GAAG,mBAAmB,EAAE,UAAU,CAAC,CAAA;KACpD;SAAM,IAAI,mBAAmB,IAAI,cAAc,EAAE;QAChD,OAAO,MAAM,CAAC,EAAE,GAAG,mBAAmB,EAAE,gBAAgB,CAAC,CAAA;KAC1D;SAAM;QACL,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAA;KACnC;AACH,CAAC;AAXD,4BAWC","sourcesContent":["import { parseNumber, formatNumber, isValidNumber, ParsedNumber } from 'libphonenumber-js'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport { Moment } from 'moment'\n\n// TODO: move this to env.js?\nconst DEFAULT_COUNTRY = 'BE'\n\nexport const nihiiRegExp = new RegExp('^(\\\\d{1})(\\\\d{5})(\\\\d{2})(\\\\d{3})$')\nexport const ssinRegExp = new RegExp('^(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})$')\nexport const ibanRegExp = new RegExp('^(\\\\d{4})(\\\\d{4})(\\\\d{4})(\\\\d{4})$')\n\nconst patterns = {\n IBAN: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n IBANBE: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n}\n\n//http://ht5ifv.serprest.pt/extensions/tools/IBAN/\nexport function isValidIBAN(iban: string) {\n //This function check if the checksum if correct\n iban = iban.replace(/^(.{4})(.*)$/, '$2$1') //Move the first 4 chars from left to the right\n const fun = (e: string) => (e.charCodeAt(0) - 'A'.charCodeAt(0) + 10).toString()\n iban = iban.replace(/[A-Z]/g, fun) //Convert A-Z to 10-25\n let $sum = 0\n let $ei = 1 //First exponent\n for (let $i = iban.length - 1; $i >= 0; $i--) {\n $sum += $ei * parseInt(iban.charAt($i), 10) //multiply the digit by it's exponent\n $ei = ($ei * 10) % 97 //compute next base 10 exponent in modulus 97\n }\n return $sum % 97 === 1\n}\n\nexport function ibanValidate(iban: string) {\n if (iban.startsWith('BE')) {\n return patterns.IBANBE(iban)\n } else {\n return patterns.IBAN(iban)\n }\n}\n\nexport function ibanFormat(iban: string): string {\n return iban.replace(ibanRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiFormat(nihii: string): string {\n return nihii.replace(nihiiRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiValidate(nihii: string): boolean {\n return !!nihii.match(nihiiRegExp)\n}\n\nexport function ssinFormat(ssin: string): string {\n return ssin.replace(ssinRegExp, '$1 $2 $3 $4 $5')\n}\n\nexport function ssinValidate(ssin: string): boolean {\n return !!ssin.match(ssinRegExp)\n}\n\n/* Alternate lib free version\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return (\n !!phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/) ||\n !!phoneNumber.match(/(0[1-9][0-9]*)([- /.]*([0-9]+))+/)\n )\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n let match = phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/)\n if (match) {\n return `+${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n match = phoneNumber.match(/0([1-9][0-9]*)([- /.]*([0-9]+))+/)\n if (match) {\n return `+32 ${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n return phoneNumber\n}\n*/\n\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return isValidNumber(phoneNumber)\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n const parsedPhoneNumber = parseNumber(phoneNumber, DEFAULT_COUNTRY) as ParsedNumber\n if (_.isEmpty(parsedPhoneNumber)) {\n // The number is not valid, so we leave the input string as-is.\n return phoneNumber\n }\n return formatNumber(parsedPhoneNumber, 'INTERNATIONAL')\n}\n\n/**\n * Converts a backend date number (e.g., patient birth date) into a Date object.\n * @param dateNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @throws Error if it is impossible to create a date from the number, other if dateNumber is negative.\n * @see #dateEncode\n * @see #timeDecode\n */\nexport function dateDecode(dateNumber: number): Date | undefined {\n if (!dateNumber) {\n return undefined\n }\n\n if (dateNumber < 0) {\n throw new Error(\"We don't decode negative dates. Please make sure you have valid data.\")\n }\n const dateNumberStr: string = _.padStart(dateNumber.toString(), 8, '19700101')\n if (dateNumberStr.length > 8) {\n if (dateNumberStr.endsWith('000000')) {\n return dateNumber ? moment(dateNumberStr, 'YYYYMMDD000000').toDate() : undefined\n }\n\n throw Error(\"Decoded date is over year 9999. We can't format it properly.\")\n }\n return dateNumber ? moment(dateNumberStr, 'YYYYMMDD').toDate() : undefined\n}\n\n/**\n * Converts a backend time number (e.g., health element openingDate) into a Date object.\n * @param timeNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @see #timeEncode\n * @see #dateDecode\n */\nexport function timeDecode(timeNumber: number): Date | undefined {\n return timeNumber ? moment(timeNumber.toString(), 'YYYYMMDDHHmmss').toDate() : undefined\n}\n\n/**\n * Encodes a Date object into a backend date number (e.g., patient birth date).\n * @param date a Date object\n * @return a YYYYMMDD date number for the backend\n * @see #dateDecode\n * @see #timeEncode\n */\nexport function dateEncode(date: Date): number | undefined {\n const dateStr = _.padStart(moment(date).format('YYYYMMDD'), 8, '19700101')\n // date is null if the field is not set\n return date ? Number(dateStr) : undefined\n}\n\n/**\n * Encodes a Date object into a backend time number (e.g., health element openingDate).\n * @param date a Date object\n * @return a YYYYMMDDHHmmss date number for the backend\n * @see #timeDecode\n * @see #dateEncode\n */\nexport function timeEncode(date: Date): number | undefined {\n return date ? Number(moment(date).format('YYYYMMDDHHmmss')) : undefined\n}\n\n/**\n * Formats a value and a physical unit into text.\n * @param value the numerical or string value to encode\n * @param unit the unit represented as a string (an empty string is also supported)\n */\nexport function unit(value: number | string, unit: string | null): string {\n unit = unit || ''\n let separator: string\n if (!unit || unit.startsWith('°')) {\n separator = ''\n } else {\n // including '%'\n separator = '\\xa0'\n }\n return value + separator + unit\n}\n\n/**\n * 0.1 + 0.2 = 0.30000000000000004. Use this function to be better at maths.\n * @param a number\n * @return the rounded number, two after the comma\n */\nexport function amount(value: number): number {\n return Number((value || 0).toFixed(2))\n}\n\n/**\n * A simple formatter to keep the logic across the app.\n * Input: 2.1 ; Output: 2.10€\n */\nexport function money(value: number): string {\n return [(value || 0).toFixed(2), '€'].join('')\n}\n\n/**\n * Transform a dictionary to a url params.\n * From { key1: value1, key2: value2, ... } returns key1=value1&key2=value2&...=...\n */\nexport function toUrlParams(params: { [key: string]: string }): string {\n return _.filter(_.map(params, (value, key) => (value ? key + '=' + value : undefined))).join('&')\n}\n\nexport function personName(person: { firstName?: string; lastName?: string }): string {\n return `${person.firstName || ''} ${person.lastName || ''}`.trim()\n}\n\nexport function personNameAbbrev(person: { firstName?: string; lastName?: string }): string {\n const firstName = person.firstName ? person.firstName[0] + '.' : undefined\n return personName({ ...person, firstName })\n}\n\nexport function toMoment(epochOrLongCalendar: number): Moment | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDD')\n } else if (epochOrLongCalendar >= 18000101000000) {\n return moment('' + epochOrLongCalendar, 'YYYYMMDDhhmmss')\n } else {\n return moment(epochOrLongCalendar)\n }\n}\n"]}
@@ -8,8 +8,9 @@ function isBIM(ct1, ct2) {
8
8
  }
9
9
  exports.isBIM = isBIM;
10
10
  function patientIsBIM(patient) {
11
+ var _a, _b;
11
12
  // FIXME this doesn't check the date of the insurability. It is related to the idea of having only on insurability at a time.
12
- return isBIM(_.get(patient, 'insurabilities[0].parameters.tc1'), _.get(patient, 'insurabilities[0].parameters.tc2'));
13
+ return isBIM((_a = _.get(patient, 'insurabilities[0].parameters.tc1')) !== null && _a !== void 0 ? _a : '000', (_b = _.get(patient, 'insurabilities[0].parameters.tc2')) !== null && _b !== void 0 ? _b : '000');
13
14
  }
14
15
  exports.patientIsBIM = patientIsBIM;
15
16
  function isPatientPaymentByIo(patient) {
@@ -1 +1 @@
1
- {"version":3,"file":"insurability-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/insurability-util.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAG3B,SAAgB,KAAK,CAAC,GAAoB,EAAE,GAAoB;IAC9D,4BAA4B;IAC5B,OAAO,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAA;AACzC,CAAC;AAHD,sBAGC;AAED,SAAgB,YAAY,CAAC,OAAgB;IAC3C,6HAA6H;IAC7H,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,kCAAkC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC,CAAA;AACtH,CAAC;AAHD,oCAGC;AAED,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,0CAA0C,CAAC,CAAA;IAC9E,OAAO,WAAW,KAAK,MAAM,CAAA;AAC/B,CAAC;AAHD,oDAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAA;IACvE,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;QACzB,iBAAiB;QACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAPD,sCAOC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;IACxD,IAAI,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;QAC/B,iBAAiB;QACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAPD,0CAOC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,IAAI,KAAK,CAAA;AAC1D,CAAC;AAFD,sDAEC","sourcesContent":["import * as _ from 'lodash'\nimport { Patient, Insurability } from '../../icc-api/model/models'\n\nexport function isBIM(ct1: number | string, ct2: number | string): boolean {\n //BIM if ct1 ood and ct2 ood\n return +ct1 % 2 !== 0 && +ct2 % 2 !== 0\n}\n\nexport function patientIsBIM(patient: Patient) {\n // FIXME this doesn't check the date of the insurability. It is related to the idea of having only on insurability at a time.\n return isBIM(_.get(patient, 'insurabilities[0].parameters.tc1'), _.get(patient, 'insurabilities[0].parameters.tc2'))\n}\n\nexport function isPatientPaymentByIo(patient: Patient) {\n const paymentByIo = _.get(patient, 'insurabilities[0].parameters.paymentByIo')\n return paymentByIo === 'true'\n}\n\n/**\n * Returns the titulary id from patient insurability\n * @throws error if the patient has no insurability data\n * @param patient The patient\n */\nexport function getMembership(patient: Patient): string {\n const ioCode = _.get(patient, 'insurabilities[0].identificationNumber')\n if (_.isUndefined(ioCode)) {\n // TODO translate\n throw new Error(\"Le patient n'a pas de données d'assurabilité\")\n }\n return ioCode\n}\n\n/**\n * Returns the insurability from patient\n * @throws error if the patient has no insurability data\n * @param patient The patient\n */\nexport function getInsurability(patient: Patient): Insurability {\n const insurability = _.get(patient, 'insurabilities[0]')\n if (_.isUndefined(insurability)) {\n // TODO translate\n throw new Error(\"Le patient n'a pas de données d'assurabilité\")\n }\n return insurability\n}\n\n/**\n * Returns the insurability from patient\n * @throws error if the patient has no insurability data\n * @param patient\n */\nexport function isPatientHospitalized(patient: Patient): boolean {\n return getInsurability(patient).hospitalisation || false\n}\n"]}
1
+ {"version":3,"file":"insurability-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/insurability-util.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAG3B,SAAgB,KAAK,CAAC,GAAoB,EAAE,GAAoB;IAC9D,4BAA4B;IAC5B,OAAO,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAA;AACzC,CAAC;AAHD,sBAGC;AAED,SAAgB,YAAY,CAAC,OAAgB;;IAC3C,6HAA6H;IAC7H,OAAO,KAAK,CAAC,MAAA,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,kCAAkC,CAAC,mCAAI,KAAK,EAAE,MAAA,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,kCAAkC,CAAC,mCAAI,KAAK,CAAC,CAAA;AACxI,CAAC;AAHD,oCAGC;AAED,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,0CAA0C,CAAC,CAAA;IAC9E,OAAO,WAAW,KAAK,MAAM,CAAA;AAC/B,CAAC;AAHD,oDAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAA;IACvE,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;QACzB,iBAAiB;QACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAPD,sCAOC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;IACxD,IAAI,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;QAC/B,iBAAiB;QACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAPD,0CAOC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,IAAI,KAAK,CAAA;AAC1D,CAAC;AAFD,sDAEC","sourcesContent":["import * as _ from 'lodash'\nimport { Patient, Insurability } from '../../icc-api/model/models'\n\nexport function isBIM(ct1: number | string, ct2: number | string): boolean {\n //BIM if ct1 ood and ct2 ood\n return +ct1 % 2 !== 0 && +ct2 % 2 !== 0\n}\n\nexport function patientIsBIM(patient: Patient) {\n // FIXME this doesn't check the date of the insurability. It is related to the idea of having only on insurability at a time.\n return isBIM(_.get(patient, 'insurabilities[0].parameters.tc1') ?? '000', _.get(patient, 'insurabilities[0].parameters.tc2') ?? '000')\n}\n\nexport function isPatientPaymentByIo(patient: Patient) {\n const paymentByIo = _.get(patient, 'insurabilities[0].parameters.paymentByIo')\n return paymentByIo === 'true'\n}\n\n/**\n * Returns the titulary id from patient insurability\n * @throws error if the patient has no insurability data\n * @param patient The patient\n */\nexport function getMembership(patient: Patient): string {\n const ioCode = _.get(patient, 'insurabilities[0].identificationNumber')\n if (_.isUndefined(ioCode)) {\n // TODO translate\n throw new Error(\"Le patient n'a pas de données d'assurabilité\")\n }\n return ioCode\n}\n\n/**\n * Returns the insurability from patient\n * @throws error if the patient has no insurability data\n * @param patient The patient\n */\nexport function getInsurability(patient: Patient): Insurability {\n const insurability = _.get(patient, 'insurabilities[0]')\n if (_.isUndefined(insurability)) {\n // TODO translate\n throw new Error(\"Le patient n'a pas de données d'assurabilité\")\n }\n return insurability\n}\n\n/**\n * Returns the insurability from patient\n * @throws error if the patient has no insurability data\n * @param patient\n */\nexport function isPatientHospitalized(patient: Patient): boolean {\n return getInsurability(patient).hospitalisation || false\n}\n"]}
@@ -1,5 +1,5 @@
1
- export declare type PaginatorFunction<X> = (key: any, docId: string | null, limit: number | undefined) => Promise<PaginatorResponse<X>>;
2
- export declare type PaginatorExecutor<X> = (latestPaginatorFunctionResult: PaginatorResponse<X>, acc: any[], limit: number | undefined) => Promise<PaginatorResponse<X>>;
1
+ export type PaginatorFunction<X> = (key: any, docId: string | null, limit: number | undefined) => Promise<PaginatorResponse<X>>;
2
+ export type PaginatorExecutor<X> = (latestPaginatorFunctionResult: PaginatorResponse<X>, acc: any[], limit: number | undefined) => Promise<PaginatorResponse<X>>;
3
3
  export interface PaginatorResponse<X> {
4
4
  rows: Array<X>;
5
5
  nextKey: any | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/api",
3
- "version": "6.0.6",
3
+ "version": "6.2.1",
4
4
  "description": "Typescript version of iCure standalone API client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",