@partium/js-sdk 14.0.2 → 14.1.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/catalog/index.js +21 -1
- package/catalog/models/catalog-image-info.js +22 -1
- package/catalog/models/catalog-image.js +40 -1
- package/catalog/models/upsert-catalog-images-dto.js +3 -1
- package/catalog/models/upsert-images-result.js +3 -1
- package/catalog/services/images.service.js +62 -1
- package/core/constants/constants.js +16 -1
- package/core/decorators/injection-identifier.js +19 -1
- package/core/factories/paginated-request-service.factory.js +33 -1
- package/core/index.js +63 -1
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +129 -1
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +138 -1
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +210 -1
- package/core/integration-defaults/http/handle-axios-error-helper.js +79 -1
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +182 -1
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +198 -1
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +32 -1
- package/core/integration-defaults/js-p-file.js +36 -1
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +206 -1
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +64 -1
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +257 -1
- package/core/integration-defaults/web-device-status.service.js +125 -1
- package/core/integration-defaults/web-file.service.js +135 -1
- package/core/integration-defaults/web-indexeddb.service.js +142 -1
- package/core/integration-defaults/web-local-storage.service.js +310 -1
- package/core/models/api-object.js +16 -1
- package/core/models/auth-config.js +72 -1
- package/core/models/device-info.js +34 -1
- package/core/models/error.js +107 -1
- package/core/models/formatted-string.js +14 -1
- package/core/models/i18n-map.js +61 -1
- package/core/models/i18n-string.js +35 -1
- package/core/models/log.js +137 -1
- package/core/models/organization.js +159 -1
- package/core/models/p-file.js +23 -1
- package/core/models/paginated-list.js +41 -1
- package/core/models/partium-config.js +43 -1
- package/core/models/user-token.js +11 -1
- package/core/models/user.js +88 -1
- package/core/services/backend-status.service.js +147 -1
- package/core/services/base-login-init.service.js +57 -1
- package/core/services/base.service.js +37 -1
- package/core/services/device-status.service.interface.js +117 -1
- package/core/services/file.service.interface.js +61 -1
- package/core/services/http/file-transfer/file-transfer.service.interface.js +125 -1
- package/core/services/http/https-client/https-client.service.interface.js +152 -1
- package/core/services/http/https.service.interface.js +294 -1
- package/core/services/http/oauth-https.service.js +218 -1
- package/core/services/local-storage.service.interface.js +378 -1
- package/core/services/log.service.js +139 -1
- package/core/services/organization.service.js +202 -1
- package/core/services/paginated-request.service.js +160 -1
- package/core/services/recent-parts.service.js +194 -1
- package/core/services/service-provider.js +114 -1
- package/core/services/session/oauth-session.service.js +104 -1
- package/core/services/session/session.service.interface.js +367 -1
- package/core/utils/general-helper.js +110 -1
- package/data/index.js +44 -1
- package/data/models/announcement.js +70 -1
- package/data/models/assembly-hierarchy-node-breadcrumb.js +51 -1
- package/data/models/assembly-hierarchy-node.js +46 -1
- package/data/models/attribute.js +106 -1
- package/data/models/csa-request-search.js +46 -1
- package/data/models/csa-request-status.js +51 -1
- package/data/models/csa-request.js +112 -1
- package/data/models/document.js +17 -1
- package/data/models/filter-key.js +36 -1
- package/data/models/filter-option-value.js +41 -1
- package/data/models/image.d.ts +6 -1
- package/data/models/image.js +77 -1
- package/data/models/inquiry.js +71 -1
- package/data/models/mounting-location.js +58 -1
- package/data/models/multiple-expert-searches.js +40 -1
- package/data/models/part-enrichment-data.js +50 -1
- package/data/models/part.js +168 -1
- package/data/models/shopping-cart.js +60 -1
- package/data/services/announcement.service.js +89 -1
- package/data/services/assembly-hierarchy-nodes.service.js +193 -1
- package/data/services/csa-helper.service.js +158 -1
- package/data/services/customer-service-assistance.service.js +276 -1
- package/data/services/filter.service.js +97 -1
- package/data/services/inquiry.service.js +68 -1
- package/data/services/part-attribute.service.js +118 -1
- package/data/services/part-enrichment.service.js +56 -1
- package/data/services/part.service.js +182 -1
- package/data/services/related-parts.service.js +83 -1
- package/data/services/shopping-cart.service.js +152 -1
- package/find/index.js +51 -1
- package/find/models/assets/asset.js +32 -1
- package/find/models/search-filter.js +205 -1
- package/find/models/search-input.js +3 -1
- package/find/models/search-output.js +3 -1
- package/find/models/search-result-status.js +40 -1
- package/find/models/search-session-log-object.js +22 -1
- package/find/models/search-status/cv-search-status.js +22 -1
- package/find/models/search-status/search-filter-status.js +36 -1
- package/find/models/search-status/search-status.js +56 -1
- package/find/models/search-status/tag-search-status.js +23 -1
- package/find/models/search-status/text-search-status.js +18 -1
- package/find/models/search-tag.js +16 -1
- package/find/models/smart-filter.js +49 -1
- package/find/models/tagable/i18n-tagable.js +37 -1
- package/find/models/tagable/tagable-base.js +22 -1
- package/find/models/tagable/tagable.js +37 -1
- package/find/models/text-search-config.js +70 -1
- package/find/models/text-search-manipulator.js +90 -1
- package/find/models/text-search-result-item/text-search-error.js +12 -1
- package/find/models/text-search-result-item/text-search-result-item-document.js +34 -1
- package/find/models/text-search-result-item/text-search-result-item-part.js +36 -1
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +35 -1
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +38 -1
- package/find/models/text-search-result-item/text-search-result-item.js +22 -1
- package/find/services/asset.service.js +348 -1
- package/find/services/filter-uploaders/filter-uploader.js +3 -1
- package/find/services/filter-uploaders/update-filters-uploader.js +77 -1
- package/find/services/filter-uploaders/update-filters.model.js +7 -1
- package/find/services/search/cv-search.service.js +214 -1
- package/find/services/search/recent-text-search-queries.service.js +260 -1
- package/find/services/search/search-result.service.js +539 -1
- package/find/services/search/search.service.js +514 -1
- package/find/services/search/tag-search.service.js +124 -1
- package/find/services/search/text-search.service.js +316 -1
- package/find/services/search-filter.service.js +292 -1
- package/find/utils/search-helper.js +75 -1
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +5 -1
- package/index.js +392 -1
- package/management/index.js +21 -1
- package/management/models/api-key-list-response.js +3 -1
- package/management/models/api-key-type.js +9 -1
- package/management/models/api-key.js +3 -1
- package/management/services/api-key.service.js +53 -1
- package/ocr/index.js +20 -1
- package/ocr/models/detect-response.js +3 -1
- package/ocr/models/detected-text-entry.js +3 -1
- package/ocr/services/ocr.service.js +59 -1
- package/package.json +1 -1
- package/user-data/index.js +21 -1
- package/user-data/models/part-with-nullable.js +3 -1
- package/user-data/models/request-list/request-list.js +63 -1
- package/user-data/services/favorite/favorite.service.js +108 -1
- package/user-data/services/request-list/request-list.service.js +133 -1
|
@@ -1,2 +1,44 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PartiumConfig = exports.AUTHENTICATION_METHOD = void 0;
|
|
5
|
+
var auth_config_1 = require("./auth-config");
|
|
6
|
+
var fetch_api_https_client_service_1 = require("../integration-defaults/http/https-client/fetch-api-https-client.service");
|
|
7
|
+
var fetch_api_file_transfer_service_1 = require("../integration-defaults/http/file-transfer/fetch-api-file-transfer.service");
|
|
8
|
+
var web_local_storage_service_1 = require("../integration-defaults/web-local-storage.service");
|
|
9
|
+
var web_device_status_service_1 = require("../integration-defaults/web-device-status.service");
|
|
10
|
+
var web_file_service_1 = require("../integration-defaults/web-file.service");
|
|
11
|
+
var AUTHENTICATION_METHOD;
|
|
12
|
+
(function (AUTHENTICATION_METHOD) {
|
|
13
|
+
AUTHENTICATION_METHOD[AUTHENTICATION_METHOD["OAUTH"] = 0] = "OAUTH";
|
|
14
|
+
AUTHENTICATION_METHOD[AUTHENTICATION_METHOD["OAUTH_API_KEY"] = 1] = "OAUTH_API_KEY";
|
|
15
|
+
})(AUTHENTICATION_METHOD || (exports.AUTHENTICATION_METHOD = AUTHENTICATION_METHOD = {}));
|
|
16
|
+
/**
|
|
17
|
+
* The Partium-configuration that is passed to the Partium-SDK for the initialization.
|
|
18
|
+
* It contains information about the backend-url, the authentication-method and it's configuration,
|
|
19
|
+
* and some references to Platform-Adapters that need to be implemented.
|
|
20
|
+
*/
|
|
21
|
+
var PartiumConfig = /** @class */ (function () {
|
|
22
|
+
function PartiumConfig(init) {
|
|
23
|
+
this.partiumApiBaseUrl = 'https://api.partium.io';
|
|
24
|
+
this.partiumLoginUrl = 'https://login.partium.io';
|
|
25
|
+
this.authenticationMethod = AUTHENTICATION_METHOD.OAUTH_API_KEY; // authentication method
|
|
26
|
+
this.recentPartsMaxPartHistoryLength = 30;
|
|
27
|
+
this.favoritePartsMaxPartLength = 50;
|
|
28
|
+
// Platform-Adapters
|
|
29
|
+
this.httpsClientService = fetch_api_https_client_service_1.FetchAPIHttpsClientService; // https client to use throughout the app, should be set to a platform specific one, eg. for web: AxiosHttpsClientService
|
|
30
|
+
this.fileTransferService = fetch_api_file_transfer_service_1.FetchAPIFileTransferService; // file-transfer service to use throughout the app, should be set to a platform specific one, eg. for web: AxiosFileTransferService
|
|
31
|
+
this.localStorageService = web_local_storage_service_1.WebLocalStorageService; // local-storage service to use throughout the app, should be set to a platform specific one, eg. for web: WebLocalStorageService
|
|
32
|
+
this.deviceStatusService = web_device_status_service_1.WebDeviceStatusService; // device-status service to use throughout the app, should be set to a platform specific one, eg. for web: WebDeviceStatusService
|
|
33
|
+
this.fileService = web_file_service_1.WebFileService;
|
|
34
|
+
Object.assign(this, init);
|
|
35
|
+
if (this.authenticationMethod === AUTHENTICATION_METHOD.OAUTH) {
|
|
36
|
+
if (!this.authenticationConfig) {
|
|
37
|
+
this.authenticationConfig = new auth_config_1.OauthAuthenticationConfig();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return PartiumConfig;
|
|
42
|
+
}());
|
|
43
|
+
exports.PartiumConfig = PartiumConfig;
|
|
44
|
+
//# sourceMappingURL=partium-config.js.map
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createUserToken = createUserToken;
|
|
5
|
+
var jwt_decode_1 = require("jwt-decode");
|
|
6
|
+
/**
|
|
7
|
+
* Decodes jwt token string and returns an object with type UserToken
|
|
8
|
+
*/
|
|
9
|
+
function createUserToken(token) {
|
|
10
|
+
return (0, jwt_decode_1.jwtDecode)(token);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=user-token.js.map
|
package/core/models/user.js
CHANGED
|
@@ -1,2 +1,89 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.User = exports.Role = void 0;
|
|
5
|
+
var Role;
|
|
6
|
+
(function (Role) {
|
|
7
|
+
Role["admin"] = "admin";
|
|
8
|
+
Role["announcementsEditor"] = "announcementsEditor";
|
|
9
|
+
/* Partium announcement editor: set via token when the Partium organization and AnnouncementsEditor role are identified within the string
|
|
10
|
+
*/
|
|
11
|
+
Role["partiumAnnouncementsEditor"] = "partiumAnnouncementsEditor";
|
|
12
|
+
/** @deprecated role does not exist in Partium */
|
|
13
|
+
Role["user"] = "user";
|
|
14
|
+
/** Partium Analytics user role */
|
|
15
|
+
Role["analyst"] = "dataAnalyst";
|
|
16
|
+
/** Partium Data Insights user role */
|
|
17
|
+
Role["dataInsightAnalyst"] = "dataInsightAnalyst";
|
|
18
|
+
Role["csa"] = "csa";
|
|
19
|
+
Role["factoryWorker"] = "factoryWorker";
|
|
20
|
+
Role["developer"] = "developer";
|
|
21
|
+
Role["catalogAdmin"] = "catalogAdmin";
|
|
22
|
+
Role["dataManipulator"] = "dataManipulator";
|
|
23
|
+
Role["dataContributor"] = "dataContributor";
|
|
24
|
+
})(Role || (exports.Role = Role = {}));
|
|
25
|
+
/**
|
|
26
|
+
* The user-object of the user that is logged in into the SDK.
|
|
27
|
+
*/
|
|
28
|
+
var User = /** @class */ (function () {
|
|
29
|
+
function User(email, role, roles, groups) {
|
|
30
|
+
if (groups === void 0) { groups = []; }
|
|
31
|
+
this.email = email;
|
|
32
|
+
this.role = role;
|
|
33
|
+
this.roles = roles ? roles : new Set([role]);
|
|
34
|
+
this.groups = groups;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a User object from a UserToken object (parsed jwt token)
|
|
38
|
+
* @param token - jwt token in UserToken format
|
|
39
|
+
* @returns created User with values populated from token
|
|
40
|
+
*/
|
|
41
|
+
User.createFromToken = function (token) {
|
|
42
|
+
// the email is optional in Keycloak, this is a workaround to not break old code (e.g. caching)
|
|
43
|
+
var email = token.email || token.preferred_username;
|
|
44
|
+
var roles = this.createRoles(token);
|
|
45
|
+
var groups = token.groups || [];
|
|
46
|
+
var firstRole = roles.values().next().value;
|
|
47
|
+
return new User(email, firstRole, roles, groups);
|
|
48
|
+
};
|
|
49
|
+
User.createRoles = function (token) {
|
|
50
|
+
// if user token already contains a property `role` it takes it
|
|
51
|
+
if (token.role) {
|
|
52
|
+
return new Set([token.role]);
|
|
53
|
+
}
|
|
54
|
+
// create roles from the `groups` token claim
|
|
55
|
+
if (token.groups) {
|
|
56
|
+
var roles = new Set();
|
|
57
|
+
for (var _i = 0, _a = token.groups; _i < _a.length; _i++) {
|
|
58
|
+
var group = _a[_i];
|
|
59
|
+
var role = this.getRoleFromGroup(group);
|
|
60
|
+
roles.add(role);
|
|
61
|
+
}
|
|
62
|
+
return roles;
|
|
63
|
+
}
|
|
64
|
+
return new Set();
|
|
65
|
+
};
|
|
66
|
+
User.getRoleFromGroup = function (group) {
|
|
67
|
+
var isPartiumOrg = this.checkPartiumRoles(group);
|
|
68
|
+
var rolePart = group.slice(group.lastIndexOf('/') + 1);
|
|
69
|
+
return this.getRoleByString(rolePart, isPartiumOrg);
|
|
70
|
+
};
|
|
71
|
+
User.checkPartiumRoles = function (group) {
|
|
72
|
+
var groupSegments = group.split('/');
|
|
73
|
+
// isPartium /partium/<role>
|
|
74
|
+
var isPartiumOrg = groupSegments[groupSegments.length - 2] === 'partium';
|
|
75
|
+
var role = groupSegments[groupSegments.length - 1];
|
|
76
|
+
var roleArray = Object.values(Role);
|
|
77
|
+
return isPartiumOrg && !!roleArray.find(function (userRole) { return userRole === role; });
|
|
78
|
+
};
|
|
79
|
+
User.getRoleByString = function (value, isPartiumOrg) {
|
|
80
|
+
if (Object.values(Role).includes(value)) {
|
|
81
|
+
var roleValue = value;
|
|
82
|
+
return roleValue === Role.announcementsEditor && isPartiumOrg ? Role.partiumAnnouncementsEditor : roleValue;
|
|
83
|
+
}
|
|
84
|
+
return Role.factoryWorker;
|
|
85
|
+
};
|
|
86
|
+
return User;
|
|
87
|
+
}());
|
|
88
|
+
exports.User = User;
|
|
89
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -1,2 +1,148 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.BackendStatusService = void 0;
|
|
26
|
+
var base_service_1 = require("./base.service");
|
|
27
|
+
var rxjs_1 = require("rxjs");
|
|
28
|
+
var error_1 = require("../models/error");
|
|
29
|
+
var operators_1 = require("rxjs/operators");
|
|
30
|
+
var https_client_service_interface_1 = require("./http/https-client/https-client.service.interface");
|
|
31
|
+
var injection_identifier_1 = require("../decorators/injection-identifier");
|
|
32
|
+
var device_status_service_interface_1 = require("./device-status.service.interface");
|
|
33
|
+
/**
|
|
34
|
+
* Service that provides functionality for contacting the Status-Backend to check
|
|
35
|
+
* the current status of the Partium-Backend and if the SDKs version is compatible
|
|
36
|
+
* with the Backend.
|
|
37
|
+
*/
|
|
38
|
+
var BackendStatusService = /** @class */ (function (_super) {
|
|
39
|
+
__extends(BackendStatusService, _super);
|
|
40
|
+
function BackendStatusService(serviceProvider) {
|
|
41
|
+
return _super.call(this, serviceProvider) || this;
|
|
42
|
+
}
|
|
43
|
+
BackendStatusService.prototype.onCreate = function () {
|
|
44
|
+
this.httpsClientService = this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService);
|
|
45
|
+
this.deviceStatusService = this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService);
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Initializes the status service
|
|
49
|
+
*
|
|
50
|
+
* @param appVersion The version of the current application
|
|
51
|
+
* @param language The desired language of the response message
|
|
52
|
+
* @param statusEndpoint The status service to check for planned downtimes, availability and compatibilitiy
|
|
53
|
+
* @param connectivityCheckFallback The endpoint that should be invoked to thest if an internet connection is available. This is example.com as default
|
|
54
|
+
* @param timeout The timeout in milliseconds, used by all http requests. It defaults to 3 seconds
|
|
55
|
+
*/
|
|
56
|
+
BackendStatusService.prototype.init = function (appVersion, language, statusEndpoint, connectivityCheckFallback, timeout) {
|
|
57
|
+
if (connectivityCheckFallback === void 0) { connectivityCheckFallback = 'https://example.com'; }
|
|
58
|
+
if (timeout === void 0) { timeout = 3000; }
|
|
59
|
+
this.appVersion = appVersion;
|
|
60
|
+
this.language = language;
|
|
61
|
+
this.statusEndpoint = statusEndpoint;
|
|
62
|
+
this.connectivityCheckFallback = connectivityCheckFallback;
|
|
63
|
+
this.timeout = timeout;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Check the compatibility of the app and the backend.
|
|
67
|
+
* Resolves if compatible, throws error if incompatible.
|
|
68
|
+
* Displays according error to the user if incompatible.
|
|
69
|
+
*/
|
|
70
|
+
BackendStatusService.prototype.checkCompatibility = function () {
|
|
71
|
+
var _this = this;
|
|
72
|
+
this.validateConfiguration();
|
|
73
|
+
return this.httpsClientService.get("".concat(this.statusEndpoint, "/compatibility?appVersion=").concat(this.appVersion, "&appName=js-partium-sdk"))
|
|
74
|
+
.pipe((0, operators_1.timeout)(this.timeout), (0, operators_1.mergeMap)(function (res) {
|
|
75
|
+
if (res.requiresUpdate) {
|
|
76
|
+
return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.SDK_OUTDATED, res.appDownloadLink));
|
|
77
|
+
}
|
|
78
|
+
return (0, rxjs_1.of)(true); // resolve
|
|
79
|
+
}), (0, operators_1.catchError)(function (error) {
|
|
80
|
+
return _this.checkAvailability()
|
|
81
|
+
.pipe((0, operators_1.map)(function (status) {
|
|
82
|
+
throw error;
|
|
83
|
+
}));
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Check the availability of the backend.
|
|
88
|
+
* Resolves if compatible, throws error if incompatible.
|
|
89
|
+
* Displays according error to the user if incompatible.
|
|
90
|
+
*/
|
|
91
|
+
BackendStatusService.prototype.checkAvailability = function () {
|
|
92
|
+
var _this = this;
|
|
93
|
+
this.validateConfiguration();
|
|
94
|
+
return (0, rxjs_1.from)(this.deviceStatusService.isConnectionAvailable())
|
|
95
|
+
.pipe((0, operators_1.mergeMap)(function (connectionStatus) {
|
|
96
|
+
if (!connectionStatus) {
|
|
97
|
+
throw new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET, null);
|
|
98
|
+
}
|
|
99
|
+
return _this.httpsClientService.get("".concat(_this.statusEndpoint, "/status?language=").concat(_this.language))
|
|
100
|
+
.pipe((0, operators_1.timeout)(_this.timeout), (0, operators_1.mergeMap)(function (res) {
|
|
101
|
+
if (res.isUp) {
|
|
102
|
+
return (0, rxjs_1.of)(true); // resolve
|
|
103
|
+
}
|
|
104
|
+
throw new error_1.SdkError(error_1.SDK_ERROR_CODES.BACKEND_DOWN, res.message);
|
|
105
|
+
}), (0, operators_1.catchError)(function (error) {
|
|
106
|
+
if (error instanceof error_1.SdkError && error.code === error_1.SDK_ERROR_CODES.BACKEND_DOWN) { // forward error
|
|
107
|
+
return (0, rxjs_1.throwError)(error);
|
|
108
|
+
}
|
|
109
|
+
// do connectivity fallback check
|
|
110
|
+
return _this.httpsClientService.get(_this.connectivityCheckFallback)
|
|
111
|
+
.pipe((0, operators_1.timeout)(_this.timeout), (0, operators_1.map)(function () {
|
|
112
|
+
throw new error_1.SdkError(error_1.SDK_ERROR_CODES.STATUS_BACKEND_DOWN, {});
|
|
113
|
+
}), (0, operators_1.catchError)(function (error) {
|
|
114
|
+
if (error instanceof error_1.SdkError && (error.code === error_1.SDK_ERROR_CODES.BACKEND_DOWN || error.code === error_1.SDK_ERROR_CODES.STATUS_BACKEND_DOWN)) { // forward error
|
|
115
|
+
return (0, rxjs_1.throwError)(error);
|
|
116
|
+
}
|
|
117
|
+
return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET, error));
|
|
118
|
+
}));
|
|
119
|
+
}));
|
|
120
|
+
}));
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Checks the configuration
|
|
124
|
+
*/
|
|
125
|
+
BackendStatusService.prototype.validateConfiguration = function () {
|
|
126
|
+
if (!this.appVersion) {
|
|
127
|
+
throw new Error("Invalid configuration: appVersion is ".concat(this.appVersion));
|
|
128
|
+
}
|
|
129
|
+
if (!this.language) {
|
|
130
|
+
throw new Error("Invalid configuration: language is ".concat(this.language));
|
|
131
|
+
}
|
|
132
|
+
if (!this.statusEndpoint) {
|
|
133
|
+
throw new Error("Invalid configuration: statusEndpoint is ".concat(this.statusEndpoint));
|
|
134
|
+
}
|
|
135
|
+
if (!this.connectivityCheckFallback) {
|
|
136
|
+
throw new Error("Invalid configuration: statusEndpoint is ".concat(this.connectivityCheckFallback));
|
|
137
|
+
}
|
|
138
|
+
if (typeof this.timeout !== 'number') {
|
|
139
|
+
throw new Error("Invalid configuration: timeout is ".concat(this.timeout, " of type ").concat(typeof this.timeout));
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
BackendStatusService = __decorate([
|
|
143
|
+
(0, injection_identifier_1.InjectionIdentifier)('BackendStatusService')
|
|
144
|
+
], BackendStatusService);
|
|
145
|
+
return BackendStatusService;
|
|
146
|
+
}(base_service_1.BaseService));
|
|
147
|
+
exports.BackendStatusService = BackendStatusService;
|
|
148
|
+
//# sourceMappingURL=backend-status.service.js.map
|
|
@@ -1,2 +1,58 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.BaseLoginInitService = void 0;
|
|
20
|
+
var rxjs_1 = require("rxjs");
|
|
21
|
+
var base_service_1 = require("./base.service");
|
|
22
|
+
/**
|
|
23
|
+
* Base class for all services that need to successfully initialize during login of the user.
|
|
24
|
+
*
|
|
25
|
+
* The init-function of Services outside the core-module can not directly be initialized,
|
|
26
|
+
* because this would lead to circular dependencies.
|
|
27
|
+
* To still allow Services to have a mandatory init-phase during login, they can be
|
|
28
|
+
* registered to be initialized during login-phase.
|
|
29
|
+
*/
|
|
30
|
+
var BaseLoginInitService = /** @class */ (function (_super) {
|
|
31
|
+
__extends(BaseLoginInitService, _super);
|
|
32
|
+
function BaseLoginInitService() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Initialization function of the service.
|
|
37
|
+
* When registered, this function will be called during login process, which can only
|
|
38
|
+
* finish successfully if this init function resolves without error.
|
|
39
|
+
*
|
|
40
|
+
* Throw an error to cancel login process.
|
|
41
|
+
*
|
|
42
|
+
* Method should be overridden by child-class
|
|
43
|
+
*
|
|
44
|
+
* @param config the PartiumConfig is passed to allow initializations using the config
|
|
45
|
+
* @param userEmail the current users eMail address
|
|
46
|
+
* @param currentOrganization$ Observable that always emits when the current organization changes
|
|
47
|
+
* @returns Observable that resolves when the initialization of the service is successful
|
|
48
|
+
*/
|
|
49
|
+
BaseLoginInitService.prototype.init = function (config, userEmail, currentOrganization$) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
this.userEmail = userEmail;
|
|
52
|
+
this.currentOrganization$ = currentOrganization$;
|
|
53
|
+
return (0, rxjs_1.of)(undefined); // resolve
|
|
54
|
+
};
|
|
55
|
+
return BaseLoginInitService;
|
|
56
|
+
}(base_service_1.BaseService));
|
|
57
|
+
exports.BaseLoginInitService = BaseLoginInitService;
|
|
58
|
+
//# sourceMappingURL=base-login-init.service.js.map
|
|
@@ -1,2 +1,38 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BaseService = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all services.
|
|
7
|
+
*
|
|
8
|
+
* Singleton instance will be managed via ServiceProvider.
|
|
9
|
+
* @Injectable-decorator makes sure that the serviceProvider can address
|
|
10
|
+
* the class by it's name, even after the code is uglified.
|
|
11
|
+
*/
|
|
12
|
+
var BaseService = /** @class */ (function () {
|
|
13
|
+
function BaseService(serviceProvider) {
|
|
14
|
+
this.serviceProvider = serviceProvider;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Function that is called after the service has been instantiated and all serviceProvider.useService()-Calls
|
|
18
|
+
* are finished. This function can be overridden if needed, it will be mainly used for service-injection to
|
|
19
|
+
* get references to other base-services.
|
|
20
|
+
*/
|
|
21
|
+
BaseService.prototype.onCreate = function () {
|
|
22
|
+
// do nothing, can be overridden by child if needed
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns the name of the class as it should be used for Service-injection.
|
|
26
|
+
* This function should not be overwritten by child-classes, it will be replaced
|
|
27
|
+
* by the decorator.
|
|
28
|
+
* This is required, because class.name can not be used after uglifying the code.
|
|
29
|
+
*
|
|
30
|
+
* @returns unique name used for service-injection
|
|
31
|
+
*/
|
|
32
|
+
BaseService.getInjectionIdentifierName = function () {
|
|
33
|
+
throw new Error("Class can not be used for Service-Injection. Add InjectionIdentifier-decorator if you want to do so.");
|
|
34
|
+
};
|
|
35
|
+
return BaseService;
|
|
36
|
+
}());
|
|
37
|
+
exports.BaseService = BaseService;
|
|
38
|
+
//# sourceMappingURL=base.service.js.map
|
|
@@ -1,2 +1,118 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
25
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
34
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
35
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
36
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
37
|
+
function step(op) {
|
|
38
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
39
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
40
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
41
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
42
|
+
switch (op[0]) {
|
|
43
|
+
case 0: case 1: t = op; break;
|
|
44
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
45
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
46
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
47
|
+
default:
|
|
48
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
49
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
50
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
51
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
52
|
+
if (t[2]) _.ops.pop();
|
|
53
|
+
_.trys.pop(); continue;
|
|
54
|
+
}
|
|
55
|
+
op = body.call(thisArg, _);
|
|
56
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
57
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.DeviceStatusService = void 0;
|
|
62
|
+
var base_service_1 = require("./base.service");
|
|
63
|
+
var injection_identifier_1 = require("../decorators/injection-identifier");
|
|
64
|
+
/**
|
|
65
|
+
* Class that defines structure of a device-status-service implementation.
|
|
66
|
+
* It contains functions that give information about the device status,
|
|
67
|
+
* such as network-connectivity.
|
|
68
|
+
*
|
|
69
|
+
* An implementation of this service is required and has to be configured during
|
|
70
|
+
* the initialization phase of Partium.
|
|
71
|
+
*
|
|
72
|
+
* This class file is called interface, even though it is not an interface,
|
|
73
|
+
* but we need it to be a concrete class for the serviceProvider.
|
|
74
|
+
*/
|
|
75
|
+
var DeviceStatusService = /** @class */ (function (_super) {
|
|
76
|
+
__extends(DeviceStatusService, _super);
|
|
77
|
+
function DeviceStatusService() {
|
|
78
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns Promise that resolves with true if connection to a network is available.
|
|
82
|
+
* (Usually the internet, but for intranet-only systems it can also be only intranet)
|
|
83
|
+
*
|
|
84
|
+
* Method should be overridden by child-class
|
|
85
|
+
*
|
|
86
|
+
* @returns promise that resolves with true or false, depending on whether a
|
|
87
|
+
* network-connection is available or not
|
|
88
|
+
*/
|
|
89
|
+
DeviceStatusService.prototype.isConnectionAvailable = function () {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
throw new Error("In order to use the DeviceStatusService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Returns Promise that resolves with a DeviceInfo object, containing
|
|
98
|
+
* information about the device and the installation.
|
|
99
|
+
* Used for logging.
|
|
100
|
+
*
|
|
101
|
+
* Method should be overridden by child-class
|
|
102
|
+
*
|
|
103
|
+
* @returns Promise that resolves with DeviceInfo
|
|
104
|
+
*/
|
|
105
|
+
DeviceStatusService.prototype.getDeviceInfo = function () {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
throw new Error("In order to use the DeviceStatusService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
DeviceStatusService = __decorate([
|
|
113
|
+
(0, injection_identifier_1.InjectionIdentifier)('DeviceStatusService')
|
|
114
|
+
], DeviceStatusService);
|
|
115
|
+
return DeviceStatusService;
|
|
116
|
+
}(base_service_1.BaseService));
|
|
117
|
+
exports.DeviceStatusService = DeviceStatusService;
|
|
118
|
+
//# sourceMappingURL=device-status.service.interface.js.map
|
|
@@ -1,2 +1,62 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.FileService = void 0;
|
|
26
|
+
var base_service_1 = require("./base.service");
|
|
27
|
+
var injection_identifier_1 = require("../decorators/injection-identifier");
|
|
28
|
+
/**
|
|
29
|
+
* Class that defines the structure for the FileService implementation.
|
|
30
|
+
*
|
|
31
|
+
* It contains functions for extract information about the assets.
|
|
32
|
+
*/
|
|
33
|
+
var FileService = /** @class */ (function (_super) {
|
|
34
|
+
__extends(FileService, _super);
|
|
35
|
+
function FileService() {
|
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get file type of a file.
|
|
40
|
+
*
|
|
41
|
+
* @param pFile The file to get the type from.
|
|
42
|
+
* @returns Promise<PFileType> The type
|
|
43
|
+
*/
|
|
44
|
+
FileService.prototype.getFileType = function (pFile) {
|
|
45
|
+
throw new Error("In order to use the FileService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Get dimensions of an image file.
|
|
49
|
+
*
|
|
50
|
+
* @param pFile The image file.
|
|
51
|
+
* @returns Promise<[number, number]> where first element is width and second one is height.
|
|
52
|
+
*/
|
|
53
|
+
FileService.prototype.getImageDimensions = function (pFile) {
|
|
54
|
+
throw new Error("In order to use the FileService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
|
|
55
|
+
};
|
|
56
|
+
FileService = __decorate([
|
|
57
|
+
(0, injection_identifier_1.InjectionIdentifier)('FileService')
|
|
58
|
+
], FileService);
|
|
59
|
+
return FileService;
|
|
60
|
+
}(base_service_1.BaseService));
|
|
61
|
+
exports.FileService = FileService;
|
|
62
|
+
//# sourceMappingURL=file.service.interface.js.map
|