@icure/api 8.6.4 → 8.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/icc-api/api/IccFormApi.d.ts +81 -0
  2. package/icc-api/api/IccFormApi.js +213 -0
  3. package/icc-api/api/IccFormApi.js.map +1 -1
  4. package/icc-x-api/icc-accesslog-x-api.d.ts +93 -0
  5. package/icc-x-api/icc-accesslog-x-api.js +93 -0
  6. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  7. package/icc-x-api/icc-calendar-item-x-api.d.ts +122 -0
  8. package/icc-x-api/icc-calendar-item-x-api.js +122 -0
  9. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  10. package/icc-x-api/icc-classification-x-api.d.ts +20 -0
  11. package/icc-x-api/icc-classification-x-api.js +20 -0
  12. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  13. package/icc-x-api/icc-code-x-api.d.ts +23 -0
  14. package/icc-x-api/icc-code-x-api.js +23 -0
  15. package/icc-x-api/icc-code-x-api.js.map +1 -1
  16. package/icc-x-api/icc-contact-x-api.d.ts +219 -1
  17. package/icc-x-api/icc-contact-x-api.js +219 -2
  18. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  19. package/icc-x-api/icc-data-owner-x-api.d.ts +14 -3
  20. package/icc-x-api/icc-data-owner-x-api.js +14 -3
  21. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  22. package/icc-x-api/icc-device-x-api.d.ts +8 -0
  23. package/icc-x-api/icc-device-x-api.js +8 -0
  24. package/icc-x-api/icc-device-x-api.js.map +1 -1
  25. package/icc-x-api/icc-doctemplate-x-api.d.ts +26 -0
  26. package/icc-x-api/icc-doctemplate-x-api.js +26 -0
  27. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  28. package/icc-x-api/icc-document-x-api.d.ts +114 -1
  29. package/icc-x-api/icc-document-x-api.js +127 -1
  30. package/icc-x-api/icc-document-x-api.js.map +1 -1
  31. package/icc-x-api/icc-form-x-api.d.ts +34 -4
  32. package/icc-x-api/icc-form-x-api.js +34 -4
  33. package/icc-x-api/icc-form-x-api.js.map +1 -1
  34. package/icc-x-api/icc-hcparty-x-api.d.ts +67 -0
  35. package/icc-x-api/icc-hcparty-x-api.js +67 -0
  36. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  37. package/icc-x-api/icc-helement-x-api.d.ts +141 -0
  38. package/icc-x-api/icc-helement-x-api.js +141 -0
  39. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  40. package/icc-x-api/icc-invoice-x-api.d.ts +54 -0
  41. package/icc-x-api/icc-invoice-x-api.js +54 -0
  42. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  43. package/icc-x-api/icc-message-x-api.d.ts +162 -0
  44. package/icc-x-api/icc-message-x-api.js +162 -0
  45. package/icc-x-api/icc-message-x-api.js.map +1 -1
  46. package/icc-x-api/icc-patient-x-api.d.ts +245 -0
  47. package/icc-x-api/icc-patient-x-api.js +245 -1
  48. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  49. package/icc-x-api/icc-receipt-x-api.d.ts +25 -0
  50. package/icc-x-api/icc-receipt-x-api.js +25 -0
  51. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  52. package/icc-x-api/icc-user-x-api.d.ts +25 -0
  53. package/icc-x-api/icc-user-x-api.js +25 -0
  54. package/icc-x-api/icc-user-x-api.js.map +1 -1
  55. package/package.json +1 -1
  56. package/test/icc-x-api/icc-form-x-api.js +265 -1
  57. package/test/icc-x-api/icc-form-x-api.js.map +1 -1
  58. package/test/utils/roles.js +5 -0
  59. package/test/utils/roles.js.map +1 -1
  60. package/test/utils/test_utils.js +1 -21
  61. package/test/utils/test_utils.js.map +1 -1
@@ -464,7 +464,7 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
464
464
  }
465
465
  // noinspection JSUnusedGlobalSymbols
466
466
  /**
467
- * Same as {@link findByMessage} but it will only return the ids of the contacts. It can also filter the documents where Document.created is between
467
+ * Same as {@link findByMessage} but it will only return the ids of the documents. It can also filter the documents where Document.created is between
468
468
  * startDate and endDate in ascending or descending order by that field. (default: ascending).
469
469
  */
470
470
  findIdsByMessage(hcpartyId, message, startDate, endDate, descending) {
@@ -474,11 +474,21 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
474
474
  return this.findDocumentIdsByDataOwnerSecretForeignKey(topmostParentId, _.uniq(extractedKeys), startDate, endDate, descending);
475
475
  });
476
476
  }
477
+ /**
478
+ * Decrypts an array of documents.
479
+ * @param documents the documents to decrypt.
480
+ * @return an array of objects containing the document and a flag indicating if it was successfully decrypted.
481
+ */
477
482
  decrypt(documents) {
478
483
  return __awaiter(this, void 0, void 0, function* () {
479
484
  return yield this.crypto.xapi.tryDecryptEntities(documents, utils_1.EntityWithDelegationTypeName.Document, (x) => new models.Document(x));
480
485
  });
481
486
  }
487
+ /**
488
+ * Encrypts an array of documents.
489
+ * @param documents the documents to encrypt.
490
+ * @return the encrypted documents.
491
+ */
482
492
  encrypt(documents) {
483
493
  return this.crypto.xapi.tryEncryptEntities(documents, utils_1.EntityWithDelegationTypeName.Document, this.encryptedFields, true, false, (x) => new models.Document(x));
484
494
  }
@@ -493,6 +503,13 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
493
503
  return this.getMainAttachmentAs(documentId, returnType);
494
504
  });
495
505
  }
506
+ /**
507
+ * Gets the main attachment of a document without decrypting it.
508
+ * @param documentId the id of the document.
509
+ * @param returnType the desired return type for the attachment data.
510
+ * @param tryHardToParseJson if true, will attempt to parse JSON even if the content type is not application/json.
511
+ * @return the attachment data in the requested format.
512
+ */
496
513
  getMainAttachmentAs(documentId_1, returnType_1) {
497
514
  return __awaiter(this, arguments, void 0, function* (documentId, returnType, tryHardToParseJson = false) {
498
515
  const url = this.host + `/document/${documentId}/attachment` + '?ts=' + new Date().getTime();
@@ -501,6 +518,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
501
518
  .catch((err) => this.handleError(err));
502
519
  });
503
520
  }
521
+ /**
522
+ * Gets and decrypts the main attachment of a document, parsing it to the requested format.
523
+ * @param document the document containing the attachment.
524
+ * @param returnType the desired return type for the attachment data.
525
+ * @return the decrypted and parsed attachment data, or undefined if decryption failed or parsing was unsuccessful.
526
+ */
504
527
  getAndTryDecryptMainAttachmentAs(document, returnType) {
505
528
  return __awaiter(this, void 0, void 0, function* () {
506
529
  const key = (yield this.crypto.xapi.encryptionKeysOf({ entity: document, type: utils_1.EntityWithDelegationTypeName.Document }, undefined))[0];
@@ -543,10 +566,21 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
543
566
  throw new Error(`Unsupported type ${returnType}`);
544
567
  }
545
568
  // noinspection JSUnusedGlobalSymbols
569
+ /**
570
+ * Converts a MIME type and file extension to a UTI (Uniform Type Identifier).
571
+ * @param mimeType the MIME type.
572
+ * @param extension the file extension.
573
+ * @return the corresponding UTI.
574
+ */
546
575
  uti(mimeType, extension) {
547
576
  return (mimeType && mimeType !== 'application/octet-stream' ? this.utiDefs[mimeType] : this.utiExts[extension]) || this.utiDefs[mimeType];
548
577
  }
549
578
  // noinspection JSUnusedGlobalSymbols
579
+ /**
580
+ * Converts a UTI (Uniform Type Identifier) to a MIME type.
581
+ * @param uti the UTI.
582
+ * @return the corresponding MIME type.
583
+ */
550
584
  mimeType(uti) {
551
585
  return this.utiRevDefs[uti];
552
586
  }
@@ -789,12 +823,27 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
789
823
  .then((r) => r.mapSuccessAsync((m) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt([m]))[0].entity; })));
790
824
  });
791
825
  }
826
+ /**
827
+ * Gets the data owners that have access to a document.
828
+ * @param entity the document.
829
+ * @return an object containing the permissions by data owner id and a flag indicating if there are unknown anonymous data owners.
830
+ */
792
831
  getDataOwnersWithAccessTo(entity) {
793
832
  return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: utils_1.EntityWithDelegationTypeName.Document });
794
833
  }
834
+ /**
835
+ * Gets the encryption keys of a document.
836
+ * @param entity the document.
837
+ * @return an array of encryption keys.
838
+ */
795
839
  getEncryptionKeysOf(entity) {
796
840
  return this.crypto.xapi.encryptionKeysOf({ entity, type: utils_1.EntityWithDelegationTypeName.Document }, undefined);
797
841
  }
842
+ /**
843
+ * Creates delegation de-anonymization metadata for a document.
844
+ * @param entity the document.
845
+ * @param delegates the data owner ids of the delegates.
846
+ */
798
847
  createDelegationDeAnonymizationMetadata(entity, delegates) {
799
848
  return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: utils_1.EntityWithDelegationTypeName.Document }, delegates);
800
849
  }
@@ -804,6 +853,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
804
853
  return Object.assign(Object.assign({}, page), { rows: (yield this.decrypt((_a = page.rows) !== null && _a !== void 0 ? _a : [])).map((x) => x.entity) });
805
854
  });
806
855
  }
856
+ /**
857
+ * Creates a new document.
858
+ * @param user the user (not used).
859
+ * @param body the document to create.
860
+ * @return the created document.
861
+ */
807
862
  createDocumentWithUser(user, body) {
808
863
  const _super = Object.create(null, {
809
864
  createDocument: { get: () => super.createDocument }
@@ -812,6 +867,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
812
867
  return (yield this.decrypt([yield _super.createDocument.call(this, (yield this.encrypt([body]))[0])]))[0].entity;
813
868
  });
814
869
  }
870
+ /**
871
+ * Deletes the main attachment of a document.
872
+ * @param user the user (not used).
873
+ * @param documentId the id of the document.
874
+ * @return the updated document.
875
+ */
815
876
  deleteAttachmentWithUser(user, documentId) {
816
877
  const _super = Object.create(null, {
817
878
  deleteAttachment: { get: () => super.deleteAttachment }
@@ -861,6 +922,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
861
922
  return (yield this.decrypt(yield _super.findWithoutDelegation.call(this, limit))).map((x) => x.entity);
862
923
  });
863
924
  }
925
+ /**
926
+ * Gets a document by id.
927
+ * @param user the user (not used).
928
+ * @param documentId the id of the document.
929
+ * @return the document.
930
+ */
864
931
  getDocumentWithUser(user, documentId) {
865
932
  const _super = Object.create(null, {
866
933
  getDocument: { get: () => super.getDocument }
@@ -869,6 +936,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
869
936
  return (yield this.decrypt([yield _super.getDocument.call(this, documentId)]))[0].entity;
870
937
  });
871
938
  }
939
+ /**
940
+ * Gets a document by external UUID.
941
+ * @param user the user (not used).
942
+ * @param externalUuid the external UUID of the document.
943
+ * @return the document.
944
+ */
872
945
  getDocumentByExternalUuidWithUser(user, externalUuid) {
873
946
  const _super = Object.create(null, {
874
947
  getDocumentByExternalUuid: { get: () => super.getDocumentByExternalUuid }
@@ -877,6 +950,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
877
950
  return (yield this.decrypt([yield _super.getDocumentByExternalUuid.call(this, externalUuid)]))[0].entity;
878
951
  });
879
952
  }
953
+ /**
954
+ * Gets multiple documents by their ids.
955
+ * @param user the user (not used).
956
+ * @param body a list of document ids.
957
+ * @return the documents.
958
+ */
880
959
  getDocumentsWithUser(user, body) {
881
960
  const _super = Object.create(null, {
882
961
  getDocuments: { get: () => super.getDocuments }
@@ -885,6 +964,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
885
964
  return (yield this.decrypt(yield _super.getDocuments.call(this, body))).map((x) => x.entity);
886
965
  });
887
966
  }
967
+ /**
968
+ * Gets all documents with a specific external UUID.
969
+ * @param user the user (not used).
970
+ * @param externalUuid the external UUID.
971
+ * @return the documents.
972
+ */
888
973
  getDocumentsByExternalUuidWithUser(user, externalUuid) {
889
974
  const _super = Object.create(null, {
890
975
  getDocumentsByExternalUuid: { get: () => super.getDocumentsByExternalUuid }
@@ -893,6 +978,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
893
978
  return (yield this.decrypt(yield _super.getDocumentsByExternalUuid.call(this, externalUuid))).map((x) => x.entity);
894
979
  });
895
980
  }
981
+ /**
982
+ * Updates a document.
983
+ * @param user the user (not used).
984
+ * @param body the document to update.
985
+ * @return the updated document.
986
+ */
896
987
  modifyDocumentWithUser(user, body) {
897
988
  const _super = Object.create(null, {
898
989
  modifyDocument: { get: () => super.modifyDocument }
@@ -901,6 +992,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
901
992
  return (yield this.decrypt([yield _super.modifyDocument.call(this, (yield this.encrypt([body]))[0])]))[0].entity;
902
993
  });
903
994
  }
995
+ /**
996
+ * Updates multiple documents.
997
+ * @param user the user (not used).
998
+ * @param body the documents to update.
999
+ * @return the updated documents.
1000
+ */
904
1001
  modifyDocumentsWithUser(user, body) {
905
1002
  const _super = Object.create(null, {
906
1003
  modifyDocuments: { get: () => super.modifyDocuments }
@@ -909,6 +1006,16 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
909
1006
  return (yield this.decrypt(yield _super.modifyDocuments.call(this, yield this.encrypt(body)))).map((x) => x.entity);
910
1007
  });
911
1008
  }
1009
+ /**
1010
+ * Sets the main attachment of a document.
1011
+ * @param user the user (not used).
1012
+ * @param documentId the id of the document.
1013
+ * @param documentRev the revision of the document.
1014
+ * @param body the attachment data.
1015
+ * @param utis an array of UTIs for the attachment.
1016
+ * @param dataIsEncrypted whether the data is already encrypted.
1017
+ * @return the updated document.
1018
+ */
912
1019
  setMainDocumentAttachmentWithUser(user, documentId, documentRev, body, utis, dataIsEncrypted) {
913
1020
  const _super = Object.create(null, {
914
1021
  setMainDocumentAttachment: { get: () => super.setMainDocumentAttachment }
@@ -917,6 +1024,17 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
917
1024
  return (yield this.decrypt([yield _super.setMainDocumentAttachment.call(this, documentId, documentRev, body, utis, dataIsEncrypted)]))[0].entity;
918
1025
  });
919
1026
  }
1027
+ /**
1028
+ * Sets a secondary attachment on a document.
1029
+ * @param user the user (not used).
1030
+ * @param documentId the id of the document.
1031
+ * @param key the key for the secondary attachment.
1032
+ * @param rev the revision of the document.
1033
+ * @param attachment the attachment data.
1034
+ * @param utis an array of UTIs for the attachment.
1035
+ * @param dataIsEncrypted whether the data is already encrypted.
1036
+ * @return the updated document.
1037
+ */
920
1038
  setSecondaryAttachmentWithUser(user, documentId, key, rev, attachment, utis, dataIsEncrypted) {
921
1039
  const _super = Object.create(null, {
922
1040
  setSecondaryAttachment: { get: () => super.setSecondaryAttachment }
@@ -925,6 +1043,14 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
925
1043
  return (yield this.decrypt([yield _super.setSecondaryAttachment.call(this, documentId, key, rev, attachment, utis, dataIsEncrypted)]))[0].entity;
926
1044
  });
927
1045
  }
1046
+ /**
1047
+ * Deletes a secondary attachment from a document.
1048
+ * @param user the user (not used).
1049
+ * @param documentId the id of the document.
1050
+ * @param key the key of the secondary attachment.
1051
+ * @param rev the revision of the document.
1052
+ * @return the updated document.
1053
+ */
928
1054
  deleteSecondaryAttachmentWithUser(user, documentId, key, rev) {
929
1055
  const _super = Object.create(null, {
930
1056
  deleteSecondaryAttachment: { get: () => super.deleteSecondaryAttachment }