@partium/js-sdk 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +100 -0
- package/README.md +18 -0
- package/core/constants/constants.d.ts +12 -0
- package/core/constants/constants.js +2 -0
- package/core/decorators/injection-identifier.d.ts +10 -0
- package/core/decorators/injection-identifier.js +2 -0
- package/core/factories/paginated-request-service.factory.d.ts +22 -0
- package/core/factories/paginated-request-service.factory.js +2 -0
- package/core/index.d.ts +47 -0
- package/core/index.js +2 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.d.ts +16 -0
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +2 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.d.ts +35 -0
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.d.ts +47 -0
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +2 -0
- package/core/integration-defaults/http/handle-axios-error-helper.d.ts +17 -0
- package/core/integration-defaults/http/handle-axios-error-helper.js +2 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.d.ts +83 -0
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +2 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.d.ts +85 -0
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +2 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.d.ts +8 -0
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +2 -0
- package/core/integration-defaults/js-p-file.d.ts +8 -0
- package/core/integration-defaults/js-p-file.js +2 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.d.ts +76 -0
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.d.ts +28 -0
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +2 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.d.ts +82 -0
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +2 -0
- package/core/integration-defaults/web-device-status.service.d.ts +24 -0
- package/core/integration-defaults/web-device-status.service.js +2 -0
- package/core/integration-defaults/web-file.service.d.ts +9 -0
- package/core/integration-defaults/web-file.service.js +2 -0
- package/core/integration-defaults/web-indexeddb.service.d.ts +19 -0
- package/core/integration-defaults/web-indexeddb.service.js +2 -0
- package/core/integration-defaults/web-local-storage.service.d.ts +157 -0
- package/core/integration-defaults/web-local-storage.service.js +2 -0
- package/core/models/api-object.d.ts +7 -0
- package/core/models/api-object.js +2 -0
- package/core/models/auth-config.d.ts +38 -0
- package/core/models/auth-config.js +2 -0
- package/core/models/device-info.d.ts +62 -0
- package/core/models/device-info.js +2 -0
- package/core/models/error.d.ts +70 -0
- package/core/models/error.js +2 -0
- package/core/models/formatted-string.d.ts +9 -0
- package/core/models/formatted-string.js +2 -0
- package/core/models/i18n-map.d.ts +34 -0
- package/core/models/i18n-map.js +2 -0
- package/core/models/i18n-string.d.ts +8 -0
- package/core/models/i18n-string.js +2 -0
- package/core/models/log.d.ts +130 -0
- package/core/models/log.js +2 -0
- package/core/models/organization.d.ts +121 -0
- package/core/models/organization.js +2 -0
- package/core/models/p-file.d.ts +17 -0
- package/core/models/p-file.js +2 -0
- package/core/models/paginated-list.d.ts +23 -0
- package/core/models/paginated-list.js +2 -0
- package/core/models/partium-config.d.ts +31 -0
- package/core/models/partium-config.js +2 -0
- package/core/models/user-token.d.ts +16 -0
- package/core/models/user-token.js +2 -0
- package/core/models/user.d.ts +48 -0
- package/core/models/user.js +2 -0
- package/core/services/backend-status.service.d.ts +46 -0
- package/core/services/backend-status.service.js +2 -0
- package/core/services/base-login-init.service.d.ts +32 -0
- package/core/services/base-login-init.service.js +2 -0
- package/core/services/base.service.d.ts +31 -0
- package/core/services/base.service.js +2 -0
- package/core/services/device-status.service.interface.d.ts +36 -0
- package/core/services/device-status.service.interface.js +2 -0
- package/core/services/file.service.interface.d.ts +24 -0
- package/core/services/file.service.interface.js +2 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.d.ts +57 -0
- package/core/services/http/file-transfer/file-transfer.service.interface.js +2 -0
- package/core/services/http/https-client/https-client.service.interface.d.ts +96 -0
- package/core/services/http/https-client/https-client.service.interface.js +2 -0
- package/core/services/http/https.service.interface.d.ts +164 -0
- package/core/services/http/https.service.interface.js +2 -0
- package/core/services/http/oauth-https.service.d.ts +120 -0
- package/core/services/http/oauth-https.service.js +2 -0
- package/core/services/local-storage.service.interface.d.ts +221 -0
- package/core/services/local-storage.service.interface.js +2 -0
- package/core/services/log.service.d.ts +48 -0
- package/core/services/log.service.js +2 -0
- package/core/services/organization.service.d.ts +48 -0
- package/core/services/organization.service.js +2 -0
- package/core/services/paginated-request.service.d.ts +104 -0
- package/core/services/paginated-request.service.js +2 -0
- package/core/services/recent-parts.service.d.ts +59 -0
- package/core/services/recent-parts.service.js +2 -0
- package/core/services/service-provider.d.ts +58 -0
- package/core/services/service-provider.js +2 -0
- package/core/services/session/oauth-session.service.d.ts +76 -0
- package/core/services/session/oauth-session.service.js +2 -0
- package/core/services/session/session.service.interface.d.ts +138 -0
- package/core/services/session/session.service.interface.js +2 -0
- package/core/utils/general-helper.d.ts +35 -0
- package/core/utils/general-helper.js +2 -0
- package/data/index.d.ts +28 -0
- package/data/index.js +2 -0
- package/data/models/announcement.d.ts +30 -0
- package/data/models/announcement.js +2 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.d.ts +10 -0
- package/data/models/assembly-hierarchy-node-breadcrumb.js +2 -0
- package/data/models/assembly-hierarchy-node.d.ts +16 -0
- package/data/models/assembly-hierarchy-node.js +2 -0
- package/data/models/attribute.d.ts +46 -0
- package/data/models/attribute.js +2 -0
- package/data/models/csa-request-search.d.ts +18 -0
- package/data/models/csa-request-search.js +2 -0
- package/data/models/csa-request-status.d.ts +16 -0
- package/data/models/csa-request-status.js +2 -0
- package/data/models/csa-request.d.ts +41 -0
- package/data/models/csa-request.js +2 -0
- package/data/models/document.d.ts +12 -0
- package/data/models/document.js +2 -0
- package/data/models/filter-key.d.ts +12 -0
- package/data/models/filter-key.js +2 -0
- package/data/models/filter-option-value.d.ts +18 -0
- package/data/models/filter-option-value.js +2 -0
- package/data/models/image.d.ts +36 -0
- package/data/models/image.js +2 -0
- package/data/models/inquiry.d.ts +32 -0
- package/data/models/inquiry.js +2 -0
- package/data/models/mounting-location.d.ts +32 -0
- package/data/models/mounting-location.js +2 -0
- package/data/models/multiple-expert-searches.d.ts +9 -0
- package/data/models/multiple-expert-searches.js +2 -0
- package/data/models/part-enrichment-data.d.ts +24 -0
- package/data/models/part-enrichment-data.js +2 -0
- package/data/models/part.d.ts +168 -0
- package/data/models/part.js +2 -0
- package/data/models/shopping-cart.d.ts +43 -0
- package/data/models/shopping-cart.js +2 -0
- package/data/services/announcement.service.d.ts +68 -0
- package/data/services/announcement.service.js +2 -0
- package/data/services/assembly-hierarchy-nodes.service.d.ts +113 -0
- package/data/services/assembly-hierarchy-nodes.service.js +2 -0
- package/data/services/csa-helper.service.d.ts +32 -0
- package/data/services/csa-helper.service.js +2 -0
- package/data/services/customer-service-assistance.service.d.ts +181 -0
- package/data/services/customer-service-assistance.service.js +2 -0
- package/data/services/filter.service.d.ts +97 -0
- package/data/services/filter.service.js +2 -0
- package/data/services/inquiry.service.d.ts +54 -0
- package/data/services/inquiry.service.js +2 -0
- package/data/services/part-attribute.service.d.ts +42 -0
- package/data/services/part-attribute.service.js +2 -0
- package/data/services/part-enrichment.service.d.ts +32 -0
- package/data/services/part-enrichment.service.js +2 -0
- package/data/services/part.service.d.ts +121 -0
- package/data/services/part.service.js +2 -0
- package/data/services/related-parts.service.d.ts +75 -0
- package/data/services/related-parts.service.js +2 -0
- package/data/services/shopping-cart.service.d.ts +150 -0
- package/data/services/shopping-cart.service.js +2 -0
- package/find/index.d.ts +35 -0
- package/find/index.js +2 -0
- package/find/models/assets/asset.d.ts +24 -0
- package/find/models/assets/asset.js +2 -0
- package/find/models/search-filter.d.ts +87 -0
- package/find/models/search-filter.js +2 -0
- package/find/models/search-input.d.ts +39 -0
- package/find/models/search-input.js +2 -0
- package/find/models/search-output.d.ts +10 -0
- package/find/models/search-output.js +2 -0
- package/find/models/search-result-status.d.ts +33 -0
- package/find/models/search-result-status.js +2 -0
- package/find/models/search-session-log-object.d.ts +16 -0
- package/find/models/search-session-log-object.js +2 -0
- package/find/models/search-status/cv-search-status.d.ts +20 -0
- package/find/models/search-status/cv-search-status.js +2 -0
- package/find/models/search-status/search-filter-status.d.ts +33 -0
- package/find/models/search-status/search-filter-status.js +2 -0
- package/find/models/search-status/search-status.d.ts +34 -0
- package/find/models/search-status/search-status.js +2 -0
- package/find/models/search-status/tag-search-status.d.ts +16 -0
- package/find/models/search-status/tag-search-status.js +2 -0
- package/find/models/search-status/text-search-status.d.ts +15 -0
- package/find/models/search-status/text-search-status.js +2 -0
- package/find/models/search-tag.d.ts +12 -0
- package/find/models/search-tag.js +2 -0
- package/find/models/smart-filter.d.ts +25 -0
- package/find/models/smart-filter.js +2 -0
- package/find/models/tagable/i18n-tagable.d.ts +10 -0
- package/find/models/tagable/i18n-tagable.js +2 -0
- package/find/models/tagable/tagable-base.d.ts +11 -0
- package/find/models/tagable/tagable-base.js +2 -0
- package/find/models/tagable/tagable.d.ts +10 -0
- package/find/models/tagable/tagable.js +2 -0
- package/find/models/text-search-config.d.ts +57 -0
- package/find/models/text-search-config.js +2 -0
- package/find/models/text-search-manipulator.d.ts +46 -0
- package/find/models/text-search-manipulator.js +2 -0
- package/find/models/text-search-result-item/text-search-error.d.ts +7 -0
- package/find/models/text-search-result-item/text-search-error.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-document.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-document.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-part.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-part.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.d.ts +10 -0
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.d.ts +12 -0
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +2 -0
- package/find/models/text-search-result-item/text-search-result-item.d.ts +16 -0
- package/find/models/text-search-result-item/text-search-result-item.js +2 -0
- package/find/services/asset.service.d.ts +160 -0
- package/find/services/asset.service.js +2 -0
- package/find/services/filter-uploaders/filter-uploader.d.ts +13 -0
- package/find/services/filter-uploaders/filter-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters-uploader.d.ts +17 -0
- package/find/services/filter-uploaders/update-filters-uploader.js +2 -0
- package/find/services/filter-uploaders/update-filters.model.d.ts +19 -0
- package/find/services/filter-uploaders/update-filters.model.js +2 -0
- package/find/services/search/cv-search.service.d.ts +103 -0
- package/find/services/search/cv-search.service.js +2 -0
- package/find/services/search/recent-text-search-queries.service.d.ts +89 -0
- package/find/services/search/recent-text-search-queries.service.js +2 -0
- package/find/services/search/search-result.service.d.ts +142 -0
- package/find/services/search/search-result.service.js +2 -0
- package/find/services/search/search.service.d.ts +291 -0
- package/find/services/search/search.service.js +2 -0
- package/find/services/search/tag-search.service.d.ts +66 -0
- package/find/services/search/tag-search.service.js +2 -0
- package/find/services/search/text-search.service.d.ts +116 -0
- package/find/services/search/text-search.service.js +2 -0
- package/find/services/search-filter.service.d.ts +223 -0
- package/find/services/search-filter.service.js +2 -0
- package/find/utils/search-helper.d.ts +14 -0
- package/find/utils/search-helper.js +2 -0
- package/gen/sdk-version.d.ts +2 -0
- package/gen/sdk-version.js +2 -0
- package/index.d.ts +121 -0
- package/index.js +2 -0
- package/management/index.d.ts +5 -0
- package/management/index.js +2 -0
- package/management/models/api-key-list-response.d.ts +10 -0
- package/management/models/api-key-list-response.js +2 -0
- package/management/models/api-key-type.d.ts +5 -0
- package/management/models/api-key-type.js +2 -0
- package/management/models/api-key.d.ts +4 -0
- package/management/models/api-key.js +2 -0
- package/management/services/api-key.service.d.ts +39 -0
- package/management/services/api-key.service.js +2 -0
- package/ocr/index.d.ts +4 -0
- package/ocr/index.js +2 -0
- package/ocr/models/detect-response.d.ts +5 -0
- package/ocr/models/detect-response.js +2 -0
- package/ocr/models/detected-text-entry.d.ts +5 -0
- package/ocr/models/detected-text-entry.js +2 -0
- package/ocr/services/ocr.service.d.ts +36 -0
- package/ocr/services/ocr.service.js +2 -0
- package/package.json +45 -0
- package/user-data/index.d.ts +5 -0
- package/user-data/index.js +2 -0
- package/user-data/models/part-with-nullable.d.ts +5 -0
- package/user-data/models/part-with-nullable.js +2 -0
- package/user-data/models/request-list/request-list.d.ts +16 -0
- package/user-data/models/request-list/request-list.js +2 -0
- package/user-data/services/favorite/favorite.service.d.ts +45 -0
- package/user-data/services/favorite/favorite.service.js +2 -0
- package/user-data/services/request-list/request-list.service.d.ts +97 -0
- package/user-data/services/request-list/request-list.service.js +2 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Copyright � 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
|
|
3
|
+
Partium Source Code License, by Partium, Inc. DBA Partium ("Licensor")
|
|
4
|
+
|
|
5
|
+
License. Licensor hereby grants the person ("You" or "Licensee") accessing or
|
|
6
|
+
using the Partium software and associated documentation files to which this
|
|
7
|
+
license is attached (the "Software", being the Partium App or SDK), a limited,
|
|
8
|
+
royalty-free, non-transferable and non-sublicensable right (a) to install and
|
|
9
|
+
use the Software in order to develop, test and prototype Your applications as
|
|
10
|
+
a Partium Integration Project ("Partium Project"), including non-transferable
|
|
11
|
+
rights to use, copy and modify the Software as necessary to integrate the
|
|
12
|
+
Software into the Your own applications and (b) to distribute and sublicense
|
|
13
|
+
the use of the Software, with or without modifications, to Your clients only
|
|
14
|
+
as part of Your applications for a Partium Project. Distribution and/or public
|
|
15
|
+
communication of the Software to Your clients are permitted only if the
|
|
16
|
+
Software is embedded in the Licensee's own applications as part of a Partium
|
|
17
|
+
Project. As an exception to the above license, you may not extract, reproduce
|
|
18
|
+
modify or use except as part of this Software the UAPARSER.JS which is part of
|
|
19
|
+
and/or downloaded and installed as the Software.
|
|
20
|
+
|
|
21
|
+
Licensee undertakings. Licensee agrees that (a) it will not remove any
|
|
22
|
+
proprietary notices on the Software; (b) it will maintain the confidentiality
|
|
23
|
+
of the Software, (c) it will only use the Software as part of a Partium
|
|
24
|
+
Project and shall not distribute the Software in any form or under any
|
|
25
|
+
agreement that allows it to be reused by any application other than Licensee's
|
|
26
|
+
applications in a Partium Project; and (d) it will not use the Software to
|
|
27
|
+
build or form part of any product that competes with the Partium product or
|
|
28
|
+
technologies as described in the associated documentation or at
|
|
29
|
+
https://partium.io.
|
|
30
|
+
|
|
31
|
+
Reservation of rights. Except as expressly licensed hereunder, Licensor and
|
|
32
|
+
its own licensors retain all ownership and intellectual property rights to the
|
|
33
|
+
Software.
|
|
34
|
+
|
|
35
|
+
Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, (A) THE
|
|
36
|
+
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF SATISFACTORY QUALITY,
|
|
38
|
+
OR FITNESS FOR A PARTICULAR PURPOSE; AND (B) IN NO EVENT SHALL THE LICENSOR BE
|
|
39
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
40
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
41
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
42
|
+
|
|
43
|
+
Data collection: The Software contains certain features that trigger tracking
|
|
44
|
+
events in the Partium cloud-service. These events are used for understanding
|
|
45
|
+
usage, improve technology, but also to provide to customer statistics (as
|
|
46
|
+
requested by them in product configuration). As delivered by Licensor, the
|
|
47
|
+
Software does not collect any personal data.
|
|
48
|
+
|
|
49
|
+
Export Controls. Export laws and regulations of the United States and any
|
|
50
|
+
other relevant local export laws and regulations apply to the Software. You
|
|
51
|
+
agree that such export control laws govern Your use of the Software (including
|
|
52
|
+
technical data) and any services deliverables provided under this agreement,
|
|
53
|
+
and You agree to comply with all such export laws and regulations (including
|
|
54
|
+
"deemed export" and "deemed re-export" regulations). You agree that no data,
|
|
55
|
+
information, program and/or materials resulting from Software or services (or
|
|
56
|
+
direct products thereof) will be exported, directly or indirectly, in
|
|
57
|
+
violation of these laws, or will be used for any purpose prohibited by these
|
|
58
|
+
laws including, without limitation, nuclear, chemical, or biological weapons
|
|
59
|
+
proliferation, or development of missile technology. Accordingly, You confirm:
|
|
60
|
+
- You will not download, provide, make available or otherwise export or
|
|
61
|
+
re-export the Software, directly or indirectly, to countries prohibited by
|
|
62
|
+
applicable laws and regulations nor to citizens, nationals, or residents of
|
|
63
|
+
those countries.
|
|
64
|
+
- You are not listed on the United States Department of Treasury lists of
|
|
65
|
+
Specially Designated Nationals and Blocked Persons, Specially Designated
|
|
66
|
+
Terrorists, and Specially Designated Narcotic Traffickers, nor are You listed
|
|
67
|
+
on the United States Department of Commerce Table of Denial Orders.
|
|
68
|
+
- You will not download or otherwise export or re-export the Software,
|
|
69
|
+
directly or indirectly, to persons on the above mentioned lists.
|
|
70
|
+
|
|
71
|
+
No support. The Licensor does not provide any support under this license.
|
|
72
|
+
Support may be provided under a separate service agreement with Licensor.
|
|
73
|
+
Updates may be provided at Licensor's discretion.
|
|
74
|
+
|
|
75
|
+
Term and Termination. This license is for the term of Your service agreement
|
|
76
|
+
with Licensor and shall automatically terminate without notice if You fail to
|
|
77
|
+
comply with any of the terms of this license or the service agreement with
|
|
78
|
+
Licensor, in which case You shall promptly stop using and destroy all copies
|
|
79
|
+
of the Software.
|
|
80
|
+
|
|
81
|
+
Third-Party components (including open source). The Software requires the use
|
|
82
|
+
of third-party software (open source or other) that is not provided with the
|
|
83
|
+
Software (as indicated in the Software documentation or listed dependencies).
|
|
84
|
+
Licensor may provide certain notices to Licensee in the Software documentation,
|
|
85
|
+
readmes or notice files in connection with such third-party software.
|
|
86
|
+
Third-party software is licensed to Licensee under the terms of the corresponding
|
|
87
|
+
software license indicated in the documentation or the repository of the listed
|
|
88
|
+
dependencies (provided to Licensee and downloaded with the dependency software
|
|
89
|
+
code). Licensee's rights to use such software are not restricted in any way by
|
|
90
|
+
this license.
|
|
91
|
+
|
|
92
|
+
Applicable Law and Jurisdiction. This Agreement is governed by the substantive
|
|
93
|
+
and procedural laws of Delaware (US), and Licensee and Licensor, agree to
|
|
94
|
+
submit to the exclusive jurisdiction of, and venue in, the courts of Delaware
|
|
95
|
+
in any dispute arising out of or relating to this Agreement.
|
|
96
|
+
|
|
97
|
+
Notices. For any questions concerning this license, or to contact the Licensor
|
|
98
|
+
for any reason, please write to support@partium.io
|
|
99
|
+
|
|
100
|
+
Version 4: 15 July 2024
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# JavaScript Partium SDK
|
|
2
|
+
|
|
3
|
+
The JavaScript Partium SDK can be integrated in JavaScript based applications to connect them to the Partium system. It is designed in a generic way so that it can be used on different platforms.
|
|
4
|
+
|
|
5
|
+
It provides all relevant functions to create Partium searches and receive the results.
|
|
6
|
+
|
|
7
|
+
(The Partium-SDK is not meant for creating or managing the Data that lies behind the searches)
|
|
8
|
+
|
|
9
|
+
## Licence
|
|
10
|
+
(c) Partium Inc. 2020-2025. All rights reserved.
|
|
11
|
+
|
|
12
|
+
Confidential and Proprietary
|
|
13
|
+
|
|
14
|
+
Restricted Distribution: Not to be used, copied, reproduced in whole or in part, nor its contents revealed in any manner to others without the express written permission of Partium.
|
|
15
|
+
|
|
16
|
+
## Installation and usage
|
|
17
|
+
|
|
18
|
+
For further details on how to install and use the Partium-SDK, have a look at the [Partium Developer-Center](https://developer.partium.io/). Ask your Partium contact for credentials to access it. If you don't yet have a contact at Partium, please get in touch at [Partium.io](https://partium.io/)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
export declare const PARTIUM_API_VERSION = 1;
|
|
3
|
+
export declare const REL_FIND_API_URL = "_find";
|
|
4
|
+
export declare const REL_DATA_API_URL = "_data";
|
|
5
|
+
export declare const REL_CSA_API_URL = "_csa";
|
|
6
|
+
export declare const REL_LOGS_API_URL = "_logs";
|
|
7
|
+
export declare const REL_USER_DATA_API_URL = "_ud";
|
|
8
|
+
export declare const REL_OCR_API_URL = "_ocr";
|
|
9
|
+
export declare const REL_AUTH_API_URL = "_auth";
|
|
10
|
+
export declare const REL_STATUS_API_URL = "_status";
|
|
11
|
+
export declare const REL_MANAGEMENT_API_URL = "management";
|
|
12
|
+
export declare const BACKEND_STATUS_FALLBACK_URL = "https://example.com";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BACKEND_STATUS_FALLBACK_URL=exports.REL_MANAGEMENT_API_URL=exports.REL_STATUS_API_URL=exports.REL_AUTH_API_URL=exports.REL_OCR_API_URL=exports.REL_USER_DATA_API_URL=exports.REL_LOGS_API_URL=exports.REL_CSA_API_URL=exports.REL_DATA_API_URL=exports.REL_FIND_API_URL=exports.PARTIUM_API_VERSION=void 0,exports.PARTIUM_API_VERSION=1,exports.REL_FIND_API_URL="_find",exports.REL_DATA_API_URL="_data",exports.REL_CSA_API_URL="_csa",exports.REL_LOGS_API_URL="_logs",exports.REL_USER_DATA_API_URL="_ud",exports.REL_OCR_API_URL="_ocr",exports.REL_AUTH_API_URL="_auth",exports.REL_STATUS_API_URL="_status",exports.REL_MANAGEMENT_API_URL="management",exports.BACKEND_STATUS_FALLBACK_URL="https://example.com";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* Add a static function called getInjectionIdentifierName, that
|
|
4
|
+
* returns the name, that was defined by InjectionIdentifier.
|
|
5
|
+
* Used for ServiceInjection.
|
|
6
|
+
*
|
|
7
|
+
* @param constructor the class that should get the method added
|
|
8
|
+
* @param name unique name to refer to this class during injection
|
|
9
|
+
*/
|
|
10
|
+
export declare const InjectionIdentifier: (name: string) => (constructor: any) => void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InjectionIdentifier=void 0;var InjectionIdentifier=function(e){return function(n){n.getInjectionIdentifierName=function(){return e}}};exports.InjectionIdentifier=InjectionIdentifier;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { APIObject } from '..';
|
|
3
|
+
import { BACKEND_SERVICE, HttpsService } from '../services/http/https.service.interface';
|
|
4
|
+
import { PaginatedRequestService } from '../services/paginated-request.service';
|
|
5
|
+
/**
|
|
6
|
+
* Factory that produces Services to fetch paginated items from a defined API-endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare class PaginatedRequestServiceFactory {
|
|
9
|
+
/**
|
|
10
|
+
* Generate a new service for fetching paginated items from a GET endpoint
|
|
11
|
+
*
|
|
12
|
+
* @param createObject function that can create an object of the requested type from the backend-response
|
|
13
|
+
* @param httpsService https-service to perform requests
|
|
14
|
+
* @param url url of the API-endpoint
|
|
15
|
+
* @param backendService which backend to target (optional)
|
|
16
|
+
* @param urlParams url parameters to append to the request (optional)
|
|
17
|
+
* @param pageSize how many items should be loaded per page (optional)
|
|
18
|
+
* @param cursorPaginationEnabled if the pagination functionality is enabled (optional)
|
|
19
|
+
* @returns service that allows to load parts from the given endpoint+configuration
|
|
20
|
+
*/
|
|
21
|
+
static generatePaginatedRequestService<T extends APIObject>(createObject: (resObj: any) => T, httpsService: HttpsService, url: string, backendService?: BACKEND_SERVICE, urlParams?: Array<Object>, pageSize?: number, cursorPaginationEnabled?: boolean): PaginatedRequestService<T>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaginatedRequestServiceFactory=void 0;var https_service_interface_1=require("../services/http/https.service.interface"),paginated_request_service_1=require("../services/paginated-request.service"),PaginatedRequestServiceFactory=function(){function e(){}return e.generatePaginatedRequestService=function(e,t,r,i,a,s,c){return void 0===i&&(i=https_service_interface_1.BACKEND_SERVICE.DATA),void 0===a&&(a=[]),void 0===s&&(s=25),new paginated_request_service_1.PaginatedRequestServiceImpl(e,t,r,i,a,s,c)},e}();exports.PaginatedRequestServiceFactory=PaginatedRequestServiceFactory;
|
package/core/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
export * from './decorators/injection-identifier';
|
|
3
|
+
export * from './integration-defaults/js-p-file';
|
|
4
|
+
export * from './integration-defaults/web-local-storage.service';
|
|
5
|
+
export * from './integration-defaults/web-device-status.service';
|
|
6
|
+
export * from './integration-defaults/web-indexeddb.service';
|
|
7
|
+
export * from './integration-defaults/web-file.service';
|
|
8
|
+
export * from './integration-defaults/http/js-oauth-keycloak-https.service';
|
|
9
|
+
export * from './integration-defaults/http/https-client/axios-https-client.service';
|
|
10
|
+
export * from './integration-defaults/http/https-client/fetch-api-https-client.service';
|
|
11
|
+
export * from './integration-defaults/http/file-transfer/axios-file-transfer.service';
|
|
12
|
+
export * from './integration-defaults/http/file-transfer/fetch-api-file-transfer.service';
|
|
13
|
+
export * from './integration-defaults/session/js-oauth-keycloak-session.service';
|
|
14
|
+
export * from './integration-defaults/session/js-oauth-keycloak-auth-config';
|
|
15
|
+
export * from './integration-defaults/session/js-oauth-api-key-session.service';
|
|
16
|
+
export * from './models/i18n-string';
|
|
17
|
+
export * from './models/partium-config';
|
|
18
|
+
export * from './models/auth-config';
|
|
19
|
+
export * from './models/p-file';
|
|
20
|
+
export * from './models/formatted-string';
|
|
21
|
+
export * from './models/i18n-map';
|
|
22
|
+
export * from './models/error';
|
|
23
|
+
export * from './models/organization';
|
|
24
|
+
export * from './models/api-object';
|
|
25
|
+
export * from './models/paginated-list';
|
|
26
|
+
export * from './models/log';
|
|
27
|
+
export * from './models/device-info';
|
|
28
|
+
export * from './models/user-token';
|
|
29
|
+
export * from './models/user';
|
|
30
|
+
export * from './services/service-provider';
|
|
31
|
+
export * from './services/local-storage.service.interface';
|
|
32
|
+
export * from './services/backend-status.service';
|
|
33
|
+
export * from './services/http/https.service.interface';
|
|
34
|
+
export * from './services/http/https-client/https-client.service.interface';
|
|
35
|
+
export * from './services/http/file-transfer/file-transfer.service.interface';
|
|
36
|
+
export * from './services/http/oauth-https.service';
|
|
37
|
+
export * from './services/base.service';
|
|
38
|
+
export * from './services/base-login-init.service';
|
|
39
|
+
export * from './services/device-status.service.interface';
|
|
40
|
+
export * from './services/session/session.service.interface';
|
|
41
|
+
export * from './services/session/oauth-session.service';
|
|
42
|
+
export * from './services/organization.service';
|
|
43
|
+
export * from './services/paginated-request.service';
|
|
44
|
+
export * from './services/log.service';
|
|
45
|
+
export * from './factories/paginated-request-service.factory';
|
|
46
|
+
export * from './services/file.service.interface';
|
|
47
|
+
export * from './services/recent-parts.service';
|
package/core/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,s){void 0===s&&(s=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,s,i)}:function(e,r,t,s){void 0===s&&(s=t),e[s]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./decorators/injection-identifier"),exports),__exportStar(require("./integration-defaults/js-p-file"),exports),__exportStar(require("./integration-defaults/web-local-storage.service"),exports),__exportStar(require("./integration-defaults/web-device-status.service"),exports),__exportStar(require("./integration-defaults/web-indexeddb.service"),exports),__exportStar(require("./integration-defaults/web-file.service"),exports),__exportStar(require("./integration-defaults/http/js-oauth-keycloak-https.service"),exports),__exportStar(require("./integration-defaults/http/https-client/axios-https-client.service"),exports),__exportStar(require("./integration-defaults/http/https-client/fetch-api-https-client.service"),exports),__exportStar(require("./integration-defaults/http/file-transfer/axios-file-transfer.service"),exports),__exportStar(require("./integration-defaults/http/file-transfer/fetch-api-file-transfer.service"),exports),__exportStar(require("./integration-defaults/session/js-oauth-keycloak-session.service"),exports),__exportStar(require("./integration-defaults/session/js-oauth-keycloak-auth-config"),exports),__exportStar(require("./integration-defaults/session/js-oauth-api-key-session.service"),exports),__exportStar(require("./models/i18n-string"),exports),__exportStar(require("./models/partium-config"),exports),__exportStar(require("./models/auth-config"),exports),__exportStar(require("./models/p-file"),exports),__exportStar(require("./models/formatted-string"),exports),__exportStar(require("./models/i18n-map"),exports),__exportStar(require("./models/error"),exports),__exportStar(require("./models/organization"),exports),__exportStar(require("./models/api-object"),exports),__exportStar(require("./models/paginated-list"),exports),__exportStar(require("./models/log"),exports),__exportStar(require("./models/device-info"),exports),__exportStar(require("./models/user-token"),exports),__exportStar(require("./models/user"),exports),__exportStar(require("./services/service-provider"),exports),__exportStar(require("./services/local-storage.service.interface"),exports),__exportStar(require("./services/backend-status.service"),exports),__exportStar(require("./services/http/https.service.interface"),exports),__exportStar(require("./services/http/https-client/https-client.service.interface"),exports),__exportStar(require("./services/http/file-transfer/file-transfer.service.interface"),exports),__exportStar(require("./services/http/oauth-https.service"),exports),__exportStar(require("./services/base.service"),exports),__exportStar(require("./services/base-login-init.service"),exports),__exportStar(require("./services/device-status.service.interface"),exports),__exportStar(require("./services/session/session.service.interface"),exports),__exportStar(require("./services/session/oauth-session.service"),exports),__exportStar(require("./services/organization.service"),exports),__exportStar(require("./services/paginated-request.service"),exports),__exportStar(require("./services/log.service"),exports),__exportStar(require("./factories/paginated-request-service.factory"),exports),__exportStar(require("./services/file.service.interface"),exports),__exportStar(require("./services/recent-parts.service"),exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { SdkError, SDK_ERROR_CODES } from "../../models/error";
|
|
4
|
+
/**
|
|
5
|
+
* Helper function that provides error-handling and -parsing functionality for fetch-API-Errors.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FetchAPIHttpErrorHelper {
|
|
8
|
+
/**
|
|
9
|
+
* Process and interpret errors that appear during the request and
|
|
10
|
+
* wrap them into SdkError objects
|
|
11
|
+
*
|
|
12
|
+
* @param error the error that occurred
|
|
13
|
+
*/
|
|
14
|
+
static processError(error: SdkError | Error | Response): Observable<never>;
|
|
15
|
+
static getErrorCodeFromError(response: Response): Promise<SDK_ERROR_CODES>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(r,e,o,t){return new(o||(o=Promise))((function(n,_){function E(r){try{R(t.next(r))}catch(r){_(r)}}function s(r){try{R(t.throw(r))}catch(r){_(r)}}function R(r){var e;r.done?n(r.value):(e=r.value,e instanceof o?e:new o((function(r){r(e)}))).then(E,s)}R((t=t.apply(r,e||[])).next())}))},__generator=this&&this.__generator||function(r,e){var o,t,n,_,E={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return _={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_;function s(s){return function(R){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;_&&(_=0,s[0]&&(E=0)),E;)try{if(o=1,t&&(n=2&s[0]?t.return:s[0]?t.throw||((n=t.return)&&n.call(t),0):t.next)&&!(n=n.call(t,s[1])).done)return n;switch(t=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return E.label++,{value:s[1],done:!1};case 5:E.label++,t=s[1],s=[0];continue;case 7:s=E.ops.pop(),E.trys.pop();continue;default:if(!(n=E.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){E=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){E.label=s[1];break}if(6===s[0]&&E.label<n[1]){E.label=n[1],n=s;break}if(n&&E.label<n[2]){E.label=n[2],E.ops.push(s);break}n[2]&&E.ops.pop(),E.trys.pop();continue}s=e.call(r,E)}catch(r){s=[6,r],t=0}finally{o=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,R])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FetchAPIHttpErrorHelper=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),error_1=require("../../models/error"),FetchAPIHttpErrorHelper=function(){function r(){}return r.processError=function(e){return e instanceof error_1.SdkError?(0,rxjs_1.throwError)(e):e instanceof Response?(0,rxjs_1.from)(r.getErrorCodeFromError(e)).pipe((0,operators_1.mergeMap)((function(r){switch(e.status){case 400:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.BAD_REQUEST,e));case 401:return-1!==[error_1.SDK_ERROR_CODES.INVALID_TOKEN,error_1.SDK_ERROR_CODES.TOKEN_EXPIRED].indexOf(r)?(0,rxjs_1.throwError)(new error_1.SdkError(r,e)):(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.USER_UNAUTHORIZED,e));case 403:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.FORBIDDEN,e));case 404:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NOT_FOUND,e));case 422:return-1!==[error_1.SDK_ERROR_CODES.INVALID_MULTIPLE_IMAGE_SEARCHES,error_1.SDK_ERROR_CODES.INVALID_SEARCH_LANGUAGE,error_1.SDK_ERROR_CODES.INVALID_SEARCH_MODALITY_CONFIG].indexOf(r)?(0,rxjs_1.throwError)(new error_1.SdkError(r,e)):(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.UNPROCESSABLE_ENTITY,e));case 500:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INTERNAL_SERVER_ERROR,e));case 501:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NOT_IMPLEMENTED,e));case 502:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.BAD_GATEWAY,e));case 503:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.SERVICE_UNAVAILABLE,e));case 504:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.GATEWAY_TIMEOUT,e))}}))):(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.UNKNOWN_ERROR,e))},r.getErrorCodeFromError=function(r){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,r.clone().json()];case 1:return e=o.sent(),console.log("res"),(null==e?void 0:e.errorCode)?[2,e.errorCode]:[3,3];case 2:return o.sent(),[2,error_1.SDK_ERROR_CODES.UNKNOWN_ERROR];case 3:return[2,error_1.SDK_ERROR_CODES.UNKNOWN_ERROR]}}))}))},r}();exports.FetchAPIHttpErrorHelper=FetchAPIHttpErrorHelper;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { DownloadStatus, FileTransferService, UploadStatus } from "../../../services/http/file-transfer/file-transfer.service.interface";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { JsPFile } from "../../js-p-file";
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of the FileTransferService for providing basic file-transfer
|
|
7
|
+
* functionality, such as upload and download, for browser-based applications.
|
|
8
|
+
*
|
|
9
|
+
* In an error case all the functions will return an SDK_ERROR_CODE.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AxiosFileTransferService extends FileTransferService {
|
|
12
|
+
private deviceStatusService;
|
|
13
|
+
onCreate(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Upload the given file-Blob to the given url and emit the upload status and
|
|
16
|
+
* progress during the upload-process.
|
|
17
|
+
*
|
|
18
|
+
* @param fileToUpload JsPFile object that wraps the file-blob to upload
|
|
19
|
+
* @param uploadUrl the target upload url (must be publicly available without authentication)
|
|
20
|
+
* @returns Observable that emits the UploadStatus
|
|
21
|
+
*/
|
|
22
|
+
uploadFile(fileToUpload: JsPFile, uploadUrl: string): Observable<UploadStatus>;
|
|
23
|
+
/**
|
|
24
|
+
* Downloads a file-Blob.
|
|
25
|
+
*
|
|
26
|
+
* @param url the file-url to download
|
|
27
|
+
* @returns Observable that emits the DownloadStatus and resolves with a JsPFile that wraps the file-blob
|
|
28
|
+
*/
|
|
29
|
+
downloadFile(url: string): Observable<DownloadStatus>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if there is internet connection and throw a NO_INTERNET, if so.
|
|
32
|
+
* Rethrow the original error otherwise.
|
|
33
|
+
*/
|
|
34
|
+
private checkInternetConnectivity;
|
|
35
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AxiosFileTransferService=void 0;var file_transfer_service_interface_1=require("../../../services/http/file-transfer/file-transfer.service.interface"),rxjs_1=require("rxjs"),axios_observable_1=require("axios-observable"),js_p_file_1=require("../../js-p-file"),operators_1=require("rxjs/operators"),handle_axios_error_helper_1=require("../handle-axios-error-helper"),device_status_service_interface_1=require("../../../services/device-status.service.interface"),error_1=require("../../../models/error"),AxiosFileTransferService=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService)},r.prototype.uploadFile=function(e,r){var t=this;return new rxjs_1.Observable((function(o){var i={method:"PUT",url:r,data:e.file,onUploadProgress:function(e){var r=Math.round(100*e.loaded/e.total);o.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFERRING,progress:r})}};t.validateIsKnownUrlOrCry(r),axios_observable_1.default.request(i).pipe((0,operators_1.catchError)((function(e){return t.checkInternetConnectivity(e)})),(0,operators_1.catchError)(handle_axios_error_helper_1.HandleAxiosErrorHelper.processError)).subscribe((function(e){o.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFER_FINISHED,progress:100}),o.complete()}),(function(e){console.log("Error while uploading file: ",e),o.error(e)}))}))},r.prototype.downloadFile=function(e){var r=this;return new rxjs_1.Observable((function(t){var o={method:"GET",url:e,responseType:"blob",onDownloadProgress:function(e){var r=Math.round(100*e.loaded/e.total);t.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFERRING,progress:r,file:null})}};r.validateIsKnownUrlOrCry(e),axios_observable_1.default.request(o).pipe((0,operators_1.catchError)(handle_axios_error_helper_1.HandleAxiosErrorHelper.processError)).subscribe((function(e){t.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFER_FINISHED,progress:100,file:new js_p_file_1.JsPFile(e.data)}),t.complete()}),(function(e){console.log("Error while downloading file: ",e),t.error(e)}))}))},r.prototype.checkInternetConnectivity=function(e){return(0,rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0,operators_1.map)((function(r){throw r?e:new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET,e)})))},r}(file_transfer_service_interface_1.FileTransferService);exports.AxiosFileTransferService=AxiosFileTransferService;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { DownloadStatus, FileTransferService, UploadStatus } from "../../../services/http/file-transfer/file-transfer.service.interface";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { JsPFile } from "../../js-p-file";
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of the FileTransferService for providing basic file-transfer
|
|
7
|
+
* functionality, such as upload and download, for browser-based applications.
|
|
8
|
+
*
|
|
9
|
+
* In an error case all the functions will return an SDK_ERROR_CODE.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FetchAPIFileTransferService extends FileTransferService {
|
|
12
|
+
private deviceStatusService;
|
|
13
|
+
onCreate(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Upload the given file-Blob to the given url and emit the upload status and
|
|
16
|
+
* progress during the upload-process.
|
|
17
|
+
*
|
|
18
|
+
* Progress not supported for Fetch API
|
|
19
|
+
*
|
|
20
|
+
* @param fileToUpload JsPFile object that wraps the file-blob to upload
|
|
21
|
+
* @param uploadUrl the target upload url (must be publicly available without authentication)
|
|
22
|
+
* @returns Observable that emits the UploadStatus
|
|
23
|
+
*/
|
|
24
|
+
uploadFile(fileToUpload: JsPFile, uploadUrl: string): Observable<UploadStatus>;
|
|
25
|
+
/**
|
|
26
|
+
* Downloads a file-Blob.
|
|
27
|
+
*
|
|
28
|
+
* Progress not supported for Fetch API
|
|
29
|
+
*
|
|
30
|
+
* @param url the file-url to download
|
|
31
|
+
* @returns Observable that emits the DownloadStatus and resolves with a JsPFile that wraps the file-blob
|
|
32
|
+
*/
|
|
33
|
+
downloadFile(url: string): Observable<DownloadStatus>;
|
|
34
|
+
/**
|
|
35
|
+
* Check if there is internet connection and throw a NO_INTERNET, if so.
|
|
36
|
+
* Rethrow the original error otherwise.
|
|
37
|
+
*/
|
|
38
|
+
private checkInternetConnectivity;
|
|
39
|
+
/**
|
|
40
|
+
* Process successful http-requests.
|
|
41
|
+
* Might also throw an error if the response contains a server-side error.
|
|
42
|
+
*
|
|
43
|
+
* @param result the response of the request
|
|
44
|
+
* @returns the requests response-data
|
|
45
|
+
*/
|
|
46
|
+
private processResponse;
|
|
47
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(s,c)}a((n=n.apply(e,r||[])).next())}))},__generator=this&&this.__generator||function(e,r){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,n=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=r.call(e,s)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FetchAPIFileTransferService=void 0;var file_transfer_service_interface_1=require("../../../services/http/file-transfer/file-transfer.service.interface"),rxjs_1=require("rxjs"),js_p_file_1=require("../../js-p-file"),operators_1=require("rxjs/operators"),device_status_service_interface_1=require("../../../services/device-status.service.interface"),error_1=require("../../../models/error"),fetch_api_http_error_helper_1=require("../fetch-api-http-error-helper"),FetchAPIFileTransferService=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService)},r.prototype.uploadFile=function(e,r){var t=this;return new rxjs_1.Observable((function(n){t.validateIsKnownUrlOrCry(r),fetch(r,{method:"PUT",body:e.file}).then((function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(r){switch(r.label){case 0:return[4,this.processResponse(e)];case 1:return r.sent(),n.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFER_FINISHED,progress:100}),n.complete(),[2]}}))}))})).catch((function(e){n.error(e)}))})).pipe((0,operators_1.catchError)((function(e){return t.checkInternetConnectivity(e)})),(0,operators_1.catchError)(fetch_api_http_error_helper_1.FetchAPIHttpErrorHelper.processError))},r.prototype.downloadFile=function(e){var r=this;return new rxjs_1.Observable((function(t){r.validateIsKnownUrlOrCry(e),fetch(e,{method:"GET"}).then((function(e){return __awaiter(r,void 0,void 0,(function(){var r;return __generator(this,(function(n){switch(n.label){case 0:return[4,this.processResponse(e)];case 1:return r=n.sent(),t.next({status:file_transfer_service_interface_1.TRANSFER_STATUS.TRANSFER_FINISHED,progress:100,file:new js_p_file_1.JsPFile(r)}),t.complete(),[2]}}))}))})).catch((function(e){t.error(e)}))})).pipe((0,operators_1.catchError)((function(e){return r.checkInternetConnectivity(e)})),(0,operators_1.catchError)(fetch_api_http_error_helper_1.FetchAPIHttpErrorHelper.processError))},r.prototype.checkInternetConnectivity=function(e){return(0,rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0,operators_1.map)((function(r){throw r?e:new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET,e)})))},r.prototype.processResponse=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){if(e.status){if(e.status>=400&&e.status<500)throw console.log("HttpsService - Client Error"),e;if(e.status>=500&&e.status<600)throw console.log("HttpsService - Server Error"),e;return 204===e.status?[2,null]:[2,e.clone().blob()]}throw e}))}))},r}(file_transfer_service_interface_1.FileTransferService);exports.FetchAPIFileTransferService=FetchAPIFileTransferService;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { AxiosError } from "axios";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { SDK_ERROR_CODES } from "../../models/error";
|
|
5
|
+
/**
|
|
6
|
+
* Helper function that provides error-handling and -parsing functionality for Axios-Errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare class HandleAxiosErrorHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Process and interpret errors that appear during the request and
|
|
11
|
+
* wrap them into SdkError objects
|
|
12
|
+
*
|
|
13
|
+
* @param error the error that occurred
|
|
14
|
+
*/
|
|
15
|
+
static processError(error: AxiosError): Observable<never>;
|
|
16
|
+
static getErrorCodeFromError(error: AxiosError): SDK_ERROR_CODES;
|
|
17
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HandleAxiosErrorHelper=void 0;var rxjs_1=require("rxjs"),error_1=require("../../models/error"),HandleAxiosErrorHelper=function(){function r(){}return r.processError=function(e){if(e instanceof error_1.SdkError)return(0,rxjs_1.throwError)(e);var o=r.getErrorCodeFromError(e);if(e.isAxiosError)if(e.response)switch(e.response.status){case 400:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.BAD_REQUEST,e));case 401:return-1!==[error_1.SDK_ERROR_CODES.INVALID_TOKEN,error_1.SDK_ERROR_CODES.TOKEN_EXPIRED].indexOf(o)?(0,rxjs_1.throwError)(new error_1.SdkError(o,e)):(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.USER_UNAUTHORIZED,e));case 403:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.FORBIDDEN,e));case 404:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NOT_FOUND,e));case 422:return-1!==[error_1.SDK_ERROR_CODES.INVALID_MULTIPLE_IMAGE_SEARCHES,error_1.SDK_ERROR_CODES.INVALID_SEARCH_LANGUAGE,error_1.SDK_ERROR_CODES.INVALID_SEARCH_MODALITY_CONFIG].indexOf(o)?(0,rxjs_1.throwError)(new error_1.SdkError(o,e)):(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.UNPROCESSABLE_ENTITY,e));case 500:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INTERNAL_SERVER_ERROR,e));case 501:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NOT_IMPLEMENTED,e));case 502:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.BAD_GATEWAY,e));case 503:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.SERVICE_UNAVAILABLE,e));case 504:return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.GATEWAY_TIMEOUT,e))}else if(e.request)return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.COULD_NOT_REACH_SERVER,e));return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.UNKNOWN_ERROR,e))},r.getErrorCodeFromError=function(r){return r.response&&r.response.data?r.response.data.errorCode:error_1.SDK_ERROR_CODES.UNKNOWN_ERROR},r}();exports.HandleAxiosErrorHelper=HandleAxiosErrorHelper;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { HttpsClientService } from '../../../services/http/https-client/https-client.service.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the HttpsClientService for providing basic https calls
|
|
6
|
+
* on browsers.
|
|
7
|
+
*
|
|
8
|
+
* In an error case all the functions will return an SDK_ERROR_CODE.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AxiosHttpsClientService extends HttpsClientService {
|
|
11
|
+
private deviceStatusService;
|
|
12
|
+
onCreate(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Send GET request to the server with the given url and content.
|
|
15
|
+
*
|
|
16
|
+
* @param url the full server url
|
|
17
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
18
|
+
* @param headers object with the request headers
|
|
19
|
+
* @returns Observable that resolves with the request result
|
|
20
|
+
*/
|
|
21
|
+
get(url: string, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Send POST request to the server with the given url and content.
|
|
24
|
+
*
|
|
25
|
+
* @param url the relative server url
|
|
26
|
+
* @param data the data to be sent with the post request
|
|
27
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
28
|
+
* @param headers object with the request headers
|
|
29
|
+
* @returns Observable that resolves with the request result
|
|
30
|
+
*/
|
|
31
|
+
post(url: string, data: any, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Send PATCH request to the server with the given url and content.
|
|
34
|
+
*
|
|
35
|
+
* @param url the relative server url
|
|
36
|
+
* @param data the data to be sent with the patch request
|
|
37
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
38
|
+
* @param headers object with the request headers
|
|
39
|
+
* @returns Observable that resolves with the request result
|
|
40
|
+
*/
|
|
41
|
+
patch(url: string, data: any, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Send DELETE request to the server with the given url and content.
|
|
44
|
+
*
|
|
45
|
+
* @param url the full server url
|
|
46
|
+
* @param data the data to be sent with the patch request
|
|
47
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
48
|
+
* @param headers object with the request headers
|
|
49
|
+
* @returns Observable that resolves with the request result
|
|
50
|
+
*/
|
|
51
|
+
delete(url: string, data?: any, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Send put request to the server with the given url and content.
|
|
54
|
+
*
|
|
55
|
+
* @param url the full server url
|
|
56
|
+
* @param data the data to be sent with the patch request
|
|
57
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
58
|
+
* @param headers object with the request headers
|
|
59
|
+
* @returns Observable that resolves with the request result
|
|
60
|
+
*/
|
|
61
|
+
put(url: string, data: any, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Wraps the requests with necessary rxjs operators for processing response
|
|
64
|
+
* and errors.
|
|
65
|
+
*
|
|
66
|
+
* @param options the axios request-config object
|
|
67
|
+
* @returns Observable that resolves with the request result
|
|
68
|
+
*/
|
|
69
|
+
private requestAsObservable;
|
|
70
|
+
/**
|
|
71
|
+
* Process successful http-requests.
|
|
72
|
+
* Might also throw an error if the response contains a server-side error.
|
|
73
|
+
*
|
|
74
|
+
* @param result the response of the request
|
|
75
|
+
* @returns the requests response-data
|
|
76
|
+
*/
|
|
77
|
+
private processResponse;
|
|
78
|
+
/**
|
|
79
|
+
* Check if there is internet connection and throw a NO_INTERNET, if so.
|
|
80
|
+
* Rethrow the original error otherwise.
|
|
81
|
+
*/
|
|
82
|
+
private checkInternetConnectivity;
|
|
83
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)};return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function s(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AxiosHttpsClientService=void 0;var rxjs_1=require("rxjs"),axios_observable_1=require("axios-observable"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("../../../services/http/https-client/https-client.service.interface"),handle_axios_error_helper_1=require("../handle-axios-error-helper"),device_status_service_interface_1=require("../../../services/device-status.service.interface"),error_1=require("../../../models/error"),AxiosHttpsClientService=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),r.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService)},r.prototype.get=function(e,r,t){return this.requestAsObservable({method:"GET",url:this.addUrlParameters(e,r),headers:t})},r.prototype.post=function(e,r,t,s){return this.requestAsObservable({method:"POST",url:this.addUrlParameters(e,t),data:r,headers:s})},r.prototype.patch=function(e,r,t,s){return this.requestAsObservable({method:"PATCH",url:this.addUrlParameters(e,t),data:r,headers:s})},r.prototype.delete=function(e,r,t,s){return this.requestAsObservable({method:"DELETE",url:this.addUrlParameters(e,t),data:r,headers:s})},r.prototype.put=function(e,r,t,s){return this.requestAsObservable({method:"PUT",url:this.addUrlParameters(e,t),data:r,headers:s})},r.prototype.requestAsObservable=function(e){var r=this;return(0,rxjs_1.defer)((function(){return r.validateIsKnownUrlOrCry(e.url),axios_observable_1.default.request(e)})).pipe((0,operators_1.map)((function(e){return r.processResponse(e)})),(0,operators_1.catchError)((function(e){return r.checkInternetConnectivity(e)})),(0,operators_1.catchError)(handle_axios_error_helper_1.HandleAxiosErrorHelper.processError))},r.prototype.processResponse=function(e){if(e.status){if(e.status>=400&&e.status<500)throw console.log("HttpsService - Client Error"),e;if(e.status>=500&&e.status<600)throw console.log("HttpsService - Server Error"),e;return e.data}throw e},r.prototype.checkInternetConnectivity=function(e){return(0,rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0,operators_1.map)((function(r){throw r?e:new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET,e)})))},r}(https_client_service_interface_1.HttpsClientService);exports.AxiosHttpsClientService=AxiosHttpsClientService;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { HttpsClientService } from '../../../services/http/https-client/https-client.service.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the HttpsClientService for providing basic https calls
|
|
6
|
+
* on browsers by using the fetch API.
|
|
7
|
+
*
|
|
8
|
+
* In an error case all the functions will return an SDK_ERROR_CODE.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FetchAPIHttpsClientService extends HttpsClientService {
|
|
11
|
+
private deviceStatusService;
|
|
12
|
+
onCreate(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Send GET request to the server with the given url and content.
|
|
15
|
+
*
|
|
16
|
+
* @param url the full server url
|
|
17
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
18
|
+
* @param headers object with the request headers
|
|
19
|
+
* @returns Observable that resolves with the request result
|
|
20
|
+
*/
|
|
21
|
+
get(url: string, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Send POST request to the server with the given url and content.
|
|
24
|
+
*
|
|
25
|
+
* @param url the relative server url
|
|
26
|
+
* @param data the data to be sent with the post request
|
|
27
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
28
|
+
* @param headers object with the request headers
|
|
29
|
+
* @returns Observable that resolves with the request result
|
|
30
|
+
*/
|
|
31
|
+
post(url: string, data: Object, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Send PATCH request to the server with the given url and content.
|
|
34
|
+
*
|
|
35
|
+
* @param url the relative server url
|
|
36
|
+
* @param data the data to be sent with the patch request
|
|
37
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
38
|
+
* @param headers object with the request headers
|
|
39
|
+
* @returns Observable that resolves with the request result
|
|
40
|
+
*/
|
|
41
|
+
patch(url: string, data: Object, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Send DELETE request to the server with the given url and content.
|
|
44
|
+
*
|
|
45
|
+
* @param url the full server url
|
|
46
|
+
* @param data the data to be sent with the patch request
|
|
47
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
48
|
+
* @param headers object with the request headers
|
|
49
|
+
* @returns Observable that resolves with the request result
|
|
50
|
+
*/
|
|
51
|
+
delete(url: string, data?: Object, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Send put request to the server with the given url and content.
|
|
54
|
+
*
|
|
55
|
+
* @param url the full server url
|
|
56
|
+
* @param data the data to be sent with the patch request
|
|
57
|
+
* @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
|
|
58
|
+
* @param headers object with the request headers
|
|
59
|
+
* @returns Observable that resolves with the request result
|
|
60
|
+
*/
|
|
61
|
+
put(url: string, data: Object, urlParams?: Array<Object>, headers?: Object): Observable<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Wraps the requests with necessary rxjs operators for processing response
|
|
64
|
+
* and errors.
|
|
65
|
+
*
|
|
66
|
+
* @param url the url to request
|
|
67
|
+
* @param options options for request, like body or header
|
|
68
|
+
* @returns Observable that resolves with the request result
|
|
69
|
+
*/
|
|
70
|
+
private requestAsObservable;
|
|
71
|
+
/**
|
|
72
|
+
* Process successful http-requests.
|
|
73
|
+
* Might also throw an error if the response contains a server-side error.
|
|
74
|
+
*
|
|
75
|
+
* @param result the response of the request
|
|
76
|
+
* @returns the requests response-data
|
|
77
|
+
*/
|
|
78
|
+
private processResponse;
|
|
79
|
+
/**
|
|
80
|
+
* Check if there is internet connection and throw a NO_INTERNET, if so.
|
|
81
|
+
* Rethrow the original error otherwise.
|
|
82
|
+
*/
|
|
83
|
+
private checkInternetConnectivity;
|
|
84
|
+
private createBody;
|
|
85
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FetchAPIHttpsClientService=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),fetch_api_http_error_helper_1=require("../fetch-api-http-error-helper"),https_client_service_interface_1=require("../../../services/http/https-client/https-client.service.interface"),device_status_service_interface_1=require("../../../services/device-status.service.interface"),error_1=require("../../../models/error"),FetchAPIHttpsClientService=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService)},t.prototype.get=function(e,t,r){return this.requestAsObservable(this.addUrlParameters(e,t),__assign({method:"GET"},r&&{headers:Object.entries(r)}))},t.prototype.post=function(e,t,r,s){return t instanceof FormData&&delete s["Content-Type"],this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"POST"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.patch=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"PATCH"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.delete=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"DELETE"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.put=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"PUT"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.requestAsObservable=function(e,t){var r=this;return new rxjs_1.Observable((function(s){r.validateIsKnownUrlOrCry(e),fetch(e,t).then((function(e){s.next(e),s.complete()})).catch((function(e){s.error(e)}))})).pipe((0,operators_1.mergeMap)((function(e){return r.processResponse(e)})),(0,operators_1.catchError)((function(e){return r.checkInternetConnectivity(e)})),(0,operators_1.catchError)(fetch_api_http_error_helper_1.FetchAPIHttpErrorHelper.processError))},t.prototype.processResponse=function(e){if(e.status){if(e.status>=400&&e.status<500)throw console.log("HttpsService - Client Error"),e;if(e.status>=500&&e.status<600)throw console.log("HttpsService - Server Error"),e;return 204===e.status?(0,rxjs_1.of)({}):(0,rxjs_1.from)(e.clone().json())}throw e},t.prototype.checkInternetConnectivity=function(e){return(0,rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0,operators_1.map)((function(t){throw t?e:new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET,e)})))},t.prototype.createBody=function(e){return"string"==typeof e||e instanceof FormData?e:JSON.stringify(e)},t}(https_client_service_interface_1.HttpsClientService);exports.FetchAPIHttpsClientService=FetchAPIHttpsClientService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { OauthHttpsService } from "../../services/http/oauth-https.service";
|
|
3
|
+
/**
|
|
4
|
+
* Keycloak-specific implementation of the OauthHttpsService for
|
|
5
|
+
* web-based Applications.
|
|
6
|
+
*/
|
|
7
|
+
export declare class JSOauthKeycloakHttpsService extends OauthHttpsService {
|
|
8
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JSOauthKeycloakHttpsService=void 0;var oauth_https_service_1=require("../../services/http/oauth-https.service"),JSOauthKeycloakHttpsService=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(oauth_https_service_1.OauthHttpsService);exports.JSOauthKeycloakHttpsService=JSOauthKeycloakHttpsService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { PFile } from "../models/p-file";
|
|
3
|
+
export declare class JsPFile extends PFile {
|
|
4
|
+
file: Blob;
|
|
5
|
+
constructor(file: Blob);
|
|
6
|
+
supportsMultipartUpload(): boolean;
|
|
7
|
+
appendToFormData(name: string, formData: FormData): void;
|
|
8
|
+
}
|