@partium/js-sdk 14.4.1 → 14.5.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 +1 -21
- package/catalog/models/catalog-image-info.js +1 -22
- package/catalog/models/catalog-image.js +1 -40
- package/catalog/models/upsert-catalog-images-dto.js +1 -3
- package/catalog/models/upsert-images-result.js +1 -3
- package/catalog/services/images.service.js +1 -62
- package/core/constants/constants.d.ts +1 -0
- package/core/constants/constants.js +1 -16
- package/core/decorators/injection-identifier.js +1 -19
- package/core/factories/paginated-request-service.factory.js +1 -33
- package/core/index.js +1 -63
- package/core/integration-defaults/http/fetch-api-http-error-helper.js +1 -129
- package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +1 -138
- package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +1 -210
- package/core/integration-defaults/http/handle-axios-error-helper.js +1 -79
- package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -182
- package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -198
- package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +1 -32
- package/core/integration-defaults/js-p-file.js +1 -36
- package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -206
- package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +1 -64
- package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -257
- package/core/integration-defaults/web-device-status.service.js +1 -125
- package/core/integration-defaults/web-file.service.js +1 -135
- package/core/integration-defaults/web-indexeddb.service.js +1 -142
- package/core/integration-defaults/web-local-storage.service.js +1 -310
- package/core/models/api-object.js +1 -16
- package/core/models/auth-config.js +1 -72
- package/core/models/device-info.js +1 -34
- package/core/models/error.js +1 -107
- package/core/models/formatted-string.js +1 -14
- package/core/models/i18n-map.js +1 -61
- package/core/models/i18n-string.js +1 -35
- package/core/models/log.js +1 -137
- package/core/models/organization.js +1 -159
- package/core/models/p-file.js +1 -23
- package/core/models/paginated-list.js +1 -41
- package/core/models/partium-config.js +1 -43
- package/core/models/user-token.js +1 -11
- package/core/models/user.js +1 -89
- package/core/services/backend-status.service.js +1 -147
- package/core/services/base-login-init.service.js +1 -57
- package/core/services/base.service.js +1 -37
- package/core/services/device-status.service.interface.js +1 -117
- package/core/services/file.service.interface.js +1 -61
- package/core/services/http/file-transfer/file-transfer.service.interface.js +1 -125
- package/core/services/http/https-client/https-client.service.interface.js +1 -152
- package/core/services/http/https.service.interface.d.ts +3 -1
- package/core/services/http/https.service.interface.js +1 -294
- package/core/services/http/oauth-https.service.js +1 -218
- package/core/services/local-storage.service.interface.js +1 -378
- package/core/services/log.service.js +1 -139
- package/core/services/organization.service.js +1 -202
- package/core/services/paginated-request.service.js +1 -154
- package/core/services/recent-parts.service.js +1 -194
- package/core/services/service-provider.js +1 -114
- package/core/services/session/oauth-session.service.js +1 -104
- package/core/services/session/session.service.interface.js +1 -367
- package/core/utils/general-helper.js +1 -110
- package/data/index.js +1 -44
- package/data/models/announcement.js +1 -70
- package/data/models/assembly-hierarchy-node-breadcrumb.js +1 -51
- package/data/models/assembly-hierarchy-node.js +1 -46
- package/data/models/attribute.js +1 -106
- package/data/models/csa-request-search.js +1 -46
- package/data/models/csa-request-status.js +1 -51
- package/data/models/csa-request.js +1 -112
- package/data/models/document.js +1 -17
- package/data/models/filter-key.js +1 -36
- package/data/models/filter-option-value.js +1 -41
- package/data/models/image.js +1 -77
- package/data/models/inquiry.js +1 -71
- package/data/models/mounting-location.js +1 -58
- package/data/models/multiple-expert-searches.js +1 -40
- package/data/models/part-enrichment-data.js +1 -50
- package/data/models/part.d.ts +1 -1
- package/data/models/part.js +1 -168
- package/data/models/shopping-cart.js +1 -60
- package/data/services/announcement.service.js +1 -89
- package/data/services/assembly-hierarchy-nodes.service.js +1 -193
- package/data/services/csa-helper.service.js +1 -158
- package/data/services/customer-service-assistance.service.js +1 -276
- package/data/services/filter.service.js +1 -97
- package/data/services/inquiry.service.js +1 -68
- package/data/services/part-attribute.service.js +1 -118
- package/data/services/part-enrichment.service.js +1 -56
- package/data/services/part.service.js +1 -182
- package/data/services/related-parts.service.js +1 -83
- package/data/services/shopping-cart.service.js +1 -152
- package/datacuration/index.d.ts +2 -0
- package/datacuration/index.js +2 -0
- package/datacuration/models/image-submission-request.d.ts +55 -0
- package/datacuration/models/image-submission-request.js +2 -0
- package/datacuration/models/submitted-image-response.d.ts +27 -0
- package/datacuration/models/submitted-image-response.js +2 -0
- package/datacuration/services/image-submission.service.d.ts +26 -0
- package/datacuration/services/image-submission.service.js +2 -0
- package/find/index.js +1 -51
- package/find/models/assets/asset.js +1 -32
- package/find/models/search-filter.js +1 -205
- package/find/models/search-input.js +1 -3
- package/find/models/search-output.js +1 -3
- package/find/models/search-result-status.js +1 -40
- package/find/models/search-session-log-object.js +1 -22
- package/find/models/search-status/cv-search-status.js +1 -22
- package/find/models/search-status/search-filter-status.js +1 -36
- package/find/models/search-status/search-status.js +1 -56
- package/find/models/search-status/tag-search-status.js +1 -23
- package/find/models/search-status/text-search-status.js +1 -18
- package/find/models/search-tag.js +1 -16
- package/find/models/smart-filter.js +1 -49
- package/find/models/tagable/i18n-tagable.js +1 -37
- package/find/models/tagable/tagable-base.js +1 -22
- package/find/models/tagable/tagable.js +1 -37
- package/find/models/text-search-config.js +1 -70
- package/find/models/text-search-manipulator.js +1 -90
- package/find/models/text-search-result-item/text-search-error.js +1 -12
- package/find/models/text-search-result-item/text-search-result-item-document.js +1 -34
- package/find/models/text-search-result-item/text-search-result-item-part.js +1 -36
- package/find/models/text-search-result-item/text-search-result-item-recent-query.js +1 -35
- package/find/models/text-search-result-item/text-search-result-item-unknown.js +1 -38
- package/find/models/text-search-result-item/text-search-result-item.js +1 -22
- package/find/services/asset.service.js +1 -348
- package/find/services/filter-uploaders/filter-uploader.js +1 -3
- package/find/services/filter-uploaders/update-filters-uploader.js +1 -77
- package/find/services/filter-uploaders/update-filters.model.js +1 -7
- package/find/services/search/cv-search.service.js +1 -214
- package/find/services/search/recent-text-search-queries.service.js +1 -260
- package/find/services/search/search-result.service.js +1 -539
- package/find/services/search/search.service.js +1 -514
- package/find/services/search/tag-search.service.js +1 -124
- package/find/services/search/text-search.service.js +1 -316
- package/find/services/search-filter.service.js +1 -292
- package/find/utils/search-helper.js +1 -75
- package/gen/sdk-version.d.ts +1 -1
- package/gen/sdk-version.js +1 -5
- package/index.d.ts +2 -0
- package/index.js +1 -392
- package/management/index.js +1 -21
- package/management/models/api-key-list-response.js +1 -3
- package/management/models/api-key-type.js +1 -9
- package/management/models/api-key.js +1 -3
- package/management/services/api-key.service.js +1 -53
- package/ocr/index.js +1 -20
- package/ocr/models/detect-response.js +1 -3
- package/ocr/models/detected-text-entry.js +1 -3
- package/ocr/services/ocr.service.js +1 -59
- package/package.json +1 -1
- package/user-data/index.js +1 -21
- package/user-data/models/part-with-nullable.js +1 -3
- package/user-data/models/request-list/request-list.js +1 -63
- package/user-data/services/favorite/favorite.service.js +1 -108
- package/user-data/services/request-list/request-list.service.js +1 -133
|
@@ -1,57 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
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.PartEnrichmentServiceImpl = void 0;
|
|
26
|
-
var rxjs_1 = require("rxjs");
|
|
27
|
-
var core_1 = require("../../core");
|
|
28
|
-
var part_enrichment_data_1 = require("../models/part-enrichment-data");
|
|
29
|
-
var PartEnrichmentServiceImpl = /** @class */ (function (_super) {
|
|
30
|
-
__extends(PartEnrichmentServiceImpl, _super);
|
|
31
|
-
function PartEnrichmentServiceImpl(serviceProvider) {
|
|
32
|
-
return _super.call(this, serviceProvider) || this;
|
|
33
|
-
}
|
|
34
|
-
PartEnrichmentServiceImpl.prototype.onCreate = function () {
|
|
35
|
-
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
36
|
-
};
|
|
37
|
-
PartEnrichmentServiceImpl.prototype.enrichPart = function (partiumPartId) {
|
|
38
|
-
return this.httpsService.post("part_types/".concat(partiumPartId, "/enrich"), {}, [], core_1.BACKEND_SERVICE.DATA).pipe((0, rxjs_1.catchError)(function (error) {
|
|
39
|
-
var _a;
|
|
40
|
-
if (((_a = error.detail) === null || _a === void 0 ? void 0 : _a['status']) === 404) {
|
|
41
|
-
throw new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_UPIS_FOUND, error.detail);
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
PartEnrichmentServiceImpl.prototype.getEnrichedData = function (partiumPartId) {
|
|
47
|
-
return this.httpsService
|
|
48
|
-
.get("part_types/".concat(partiumPartId, "/enrichment-status"), [], core_1.BACKEND_SERVICE.DATA)
|
|
49
|
-
.pipe((0, rxjs_1.map)(function (response) { return part_enrichment_data_1.PartEnrichmentData.fromAPIResponse(response); }));
|
|
50
|
-
};
|
|
51
|
-
PartEnrichmentServiceImpl = __decorate([
|
|
52
|
-
(0, core_1.InjectionIdentifier)('PartEnrichmentService')
|
|
53
|
-
], PartEnrichmentServiceImpl);
|
|
54
|
-
return PartEnrichmentServiceImpl;
|
|
55
|
-
}(core_1.BaseService));
|
|
56
|
-
exports.PartEnrichmentServiceImpl = PartEnrichmentServiceImpl;
|
|
57
|
-
//# sourceMappingURL=part-enrichment.service.js.map
|
|
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 n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__decorate=this&&this.__decorate||function(e,t,r,n){var o,c=arguments.length,i=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(c<3?o(i):c>3?o(t,r,i):o(t,r))||i);return c>3&&i&&Object.defineProperty(t,r,i),i};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PartEnrichmentServiceImpl=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),part_enrichment_data_1=require("../models/part-enrichment-data"),PartEnrichmentServiceImpl=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.enrichPart=function(e){return this.httpsService.post("part_types/".concat(e,"/enrich"),{},[],core_1.BACKEND_SERVICE.DATA).pipe((0,rxjs_1.catchError)((function(e){var t;if(404===(null===(t=e.detail)||void 0===t?void 0:t.status))throw new core_1.SdkError(core_1.SDK_ERROR_CODES.NO_UPIS_FOUND,e.detail);throw e})))},t.prototype.getEnrichedData=function(e){return this.httpsService.get("part_types/".concat(e,"/enrichment-status"),[],core_1.BACKEND_SERVICE.DATA).pipe((0,rxjs_1.map)((function(e){return part_enrichment_data_1.PartEnrichmentData.fromAPIResponse(e)})))},t=__decorate([(0,core_1.InjectionIdentifier)("PartEnrichmentService")],t)}(core_1.BaseService);exports.PartEnrichmentServiceImpl=PartEnrichmentServiceImpl;
|
|
@@ -1,183 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
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 __assign = (this && this.__assign) || function () {
|
|
19
|
-
__assign = Object.assign || function(t) {
|
|
20
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
21
|
-
s = arguments[i];
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
23
|
-
t[p] = s[p];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
|
-
return __assign.apply(this, arguments);
|
|
28
|
-
};
|
|
29
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
31
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
32
|
-
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;
|
|
33
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34
|
-
};
|
|
35
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
36
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
37
|
-
if (ar || !(i in from)) {
|
|
38
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
39
|
-
ar[i] = from[i];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.PartServiceImpl = void 0;
|
|
46
|
-
var rxjs_1 = require("rxjs");
|
|
47
|
-
var operators_1 = require("rxjs/operators");
|
|
48
|
-
var core_1 = require("../../core");
|
|
49
|
-
var part_1 = require("../models/part");
|
|
50
|
-
var mounting_location_1 = require("../models/mounting-location");
|
|
51
|
-
var PartServiceImpl = /** @class */ (function (_super) {
|
|
52
|
-
__extends(PartServiceImpl, _super);
|
|
53
|
-
function PartServiceImpl(serviceProvider) {
|
|
54
|
-
var _this = _super.call(this, serviceProvider) || this;
|
|
55
|
-
_this.DOWNLOAD_PAGE_SIZE = 250;
|
|
56
|
-
_this.PAGINATION_PAGE_SIZE = 25; // size of page when retrieving page of items and user decides when to load next page
|
|
57
|
-
return _this;
|
|
58
|
-
}
|
|
59
|
-
PartServiceImpl.prototype.onCreate = function () {
|
|
60
|
-
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
61
|
-
};
|
|
62
|
-
PartServiceImpl.prototype.getPart = function (partiumPartId, options) {
|
|
63
|
-
return this.loadPartFromServer(partiumPartId, options).pipe((0, operators_1.catchError)(function (error) {
|
|
64
|
-
console.log('Error while loading part-information from server.', error);
|
|
65
|
-
return (0, rxjs_1.throwError)(error);
|
|
66
|
-
}));
|
|
67
|
-
};
|
|
68
|
-
PartServiceImpl.prototype.getParts = function (partiumPartIds) {
|
|
69
|
-
var _this = this;
|
|
70
|
-
return this.loadPartsFromServer(partiumPartIds).pipe((0, operators_1.map)(function (parts) { return _this.orderParts(parts, partiumPartIds); }), (0, operators_1.mergeMap)(function (parts) {
|
|
71
|
-
console.log('Warning: nonexistent partium ids will be ignored');
|
|
72
|
-
return (0, rxjs_1.of)(parts.filter(function (part) { return !!part; }));
|
|
73
|
-
}), (0, operators_1.catchError)(function (error) {
|
|
74
|
-
console.log('Error while loading part-information from server.', error);
|
|
75
|
-
return (0, rxjs_1.throwError)(error);
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
|
-
PartServiceImpl.prototype.getPartsByAssemblyHierarchyNodeId = function (assemblyHierarchyNodeId) {
|
|
79
|
-
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(part_1.Part.fromAPIResponse, this.httpsService, 'part_types', core_1.BACKEND_SERVICE.DATA, [{ assembly_uuid: assemblyHierarchyNodeId }], this.PAGINATION_PAGE_SIZE);
|
|
80
|
-
};
|
|
81
|
-
PartServiceImpl.prototype.getMountingLocationsForPart = function (partPartiumId, prioritizedLocationIds) {
|
|
82
|
-
return this.httpsService
|
|
83
|
-
.post("part_types/".concat(partPartiumId, "/mounting-locations"), __assign({}, (prioritizedLocationIds && { priority_locations: prioritizedLocationIds })), [], core_1.BACKEND_SERVICE.DATA)
|
|
84
|
-
.pipe((0, operators_1.map)(function (responseData) {
|
|
85
|
-
return mounting_location_1.PartMountingLocationInfo.fromAPIResponse(responseData);
|
|
86
|
-
}));
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Load the requested part from the server.
|
|
90
|
-
*
|
|
91
|
-
* @param partiumPartId the partium-id of the parts to get
|
|
92
|
-
* @param options options for the request
|
|
93
|
-
*/
|
|
94
|
-
PartServiceImpl.prototype.loadPartFromServer = function (partiumPartId, options) {
|
|
95
|
-
var urlParams = [];
|
|
96
|
-
if (options === null || options === void 0 ? void 0 : options.includeMountingLocations) {
|
|
97
|
-
urlParams.push({ include_mounting_locations: options.includeMountingLocations });
|
|
98
|
-
}
|
|
99
|
-
if (options === null || options === void 0 ? void 0 : options.includeSummary) {
|
|
100
|
-
urlParams.push({ include_summary: options.includeSummary });
|
|
101
|
-
}
|
|
102
|
-
if (options === null || options === void 0 ? void 0 : options.includeEnrichment) {
|
|
103
|
-
urlParams.push({ include_enrichment: options.includeEnrichment });
|
|
104
|
-
}
|
|
105
|
-
return this.httpsService
|
|
106
|
-
.get("part_types/".concat(partiumPartId), urlParams, core_1.BACKEND_SERVICE.DATA)
|
|
107
|
-
.pipe((0, operators_1.map)(function (partiumPartData) { return part_1.Part.fromAPIResponse(partiumPartData); }));
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Load all requested parts from the server.
|
|
111
|
-
* Since the response is paginated, it is necessary to do as many request as needed until
|
|
112
|
-
* all nodes are loaded.
|
|
113
|
-
*
|
|
114
|
-
* @param partiumPartIds the partium-ids of the parts to get
|
|
115
|
-
*/
|
|
116
|
-
PartServiceImpl.prototype.loadPartsFromServer = function (partiumPartIds) {
|
|
117
|
-
var _this = this;
|
|
118
|
-
var i = 1;
|
|
119
|
-
var repeat$ = new rxjs_1.Subject();
|
|
120
|
-
// do as many requests (1 per page) until all nodes are loaded
|
|
121
|
-
// we use "defer" here instead of using requestPaginatedParts directly, because this allows us to increase the page-number, which is passed to the function. Otherwise it would always be called with the same value.
|
|
122
|
-
return (0, rxjs_1.defer)(function () { return _this.requestPaginatedParts(partiumPartIds, i); }).pipe((0, operators_1.map)(function (res) {
|
|
123
|
-
var pageSize = res['pagination']['page_size'];
|
|
124
|
-
var itemsCnt = res['pagination']['items_count'];
|
|
125
|
-
var pageCnt = Math.ceil(itemsCnt / pageSize);
|
|
126
|
-
if (i >= pageCnt) {
|
|
127
|
-
repeat$.complete(); // final page reached
|
|
128
|
-
}
|
|
129
|
-
else if (i++ < pageCnt) {
|
|
130
|
-
setTimeout(function () {
|
|
131
|
-
repeat$.next(); // more pages to load
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return res['results'];
|
|
135
|
-
}), (0, operators_1.repeatWhen)(function () { return repeat$.asObservable(); }), (0, operators_1.reduce)(function (cum, newItems) {
|
|
136
|
-
return __spreadArray(__spreadArray([], cum, true), newItems, true);
|
|
137
|
-
}), (0, operators_1.map)(function (partsData) {
|
|
138
|
-
return partsData.map(function (partData) { return part_1.Part.fromAPIResponse(partData, part_1.DATA_ORIGIN.DATA_API); });
|
|
139
|
-
}));
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Sent request for one page of nodes
|
|
143
|
-
*
|
|
144
|
-
* @param page the current page of the pagination (1-indexed)
|
|
145
|
-
*/
|
|
146
|
-
PartServiceImpl.prototype.requestPaginatedParts = function (partiumPartIds, page) {
|
|
147
|
-
return this.httpsService.post("part_types/many", {
|
|
148
|
-
uuids: partiumPartIds,
|
|
149
|
-
}, [
|
|
150
|
-
{
|
|
151
|
-
page: page,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
page_size: this.DOWNLOAD_PAGE_SIZE,
|
|
155
|
-
},
|
|
156
|
-
], core_1.BACKEND_SERVICE.DATA);
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Order the given parts by the part-ids given in the part-id-array.
|
|
160
|
-
* If any part is not found in unorderedParts, the array contains null instead.
|
|
161
|
-
*
|
|
162
|
-
* @param unorderedParts the parts to order
|
|
163
|
-
* @param partiumPartIds the order in which to sort
|
|
164
|
-
* @returns array of given parts, ordered by partiumPartIds (contains null for parts not found)
|
|
165
|
-
*/
|
|
166
|
-
PartServiceImpl.prototype.orderParts = function (unorderedParts, partiumPartIds) {
|
|
167
|
-
var orderedParts = [];
|
|
168
|
-
var _loop_1 = function (id) {
|
|
169
|
-
orderedParts.push(unorderedParts.find(function (part) { return part && part.partiumId === id; }));
|
|
170
|
-
};
|
|
171
|
-
for (var _i = 0, partiumPartIds_1 = partiumPartIds; _i < partiumPartIds_1.length; _i++) {
|
|
172
|
-
var id = partiumPartIds_1[_i];
|
|
173
|
-
_loop_1(id);
|
|
174
|
-
}
|
|
175
|
-
return orderedParts;
|
|
176
|
-
};
|
|
177
|
-
PartServiceImpl = __decorate([
|
|
178
|
-
(0, core_1.InjectionIdentifier)('PartService')
|
|
179
|
-
], PartServiceImpl);
|
|
180
|
-
return PartServiceImpl;
|
|
181
|
-
}(core_1.BaseService));
|
|
182
|
-
exports.PartServiceImpl = PartServiceImpl;
|
|
183
|
-
//# sourceMappingURL=part.service.js.map
|
|
2
|
+
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])},r(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(r){for(var t,e=1,o=arguments.length;e<o;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},__assign.apply(this,arguments)},__decorate=this&&this.__decorate||function(r,t,e,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(r,t,e,o);else for(var s=r.length-1;s>=0;s--)(n=r[s])&&(a=(i<3?n(a):i>3?n(t,e,a):n(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},__spreadArray=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PartServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),core_1=require("../../core"),part_1=require("../models/part"),mounting_location_1=require("../models/mounting-location"),PartServiceImpl=function(r){function t(t){var e=r.call(this,t)||this;return e.DOWNLOAD_PAGE_SIZE=250,e.PAGINATION_PAGE_SIZE=25,e}return __extends(t,r),t.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},t.prototype.getPart=function(r,t){return this.loadPartFromServer(r,t).pipe((0,operators_1.catchError)((function(r){return console.log("Error while loading part-information from server.",r),(0,rxjs_1.throwError)(r)})))},t.prototype.getParts=function(r){var t=this;return this.loadPartsFromServer(r).pipe((0,operators_1.map)((function(e){return t.orderParts(e,r)})),(0,operators_1.mergeMap)((function(r){return console.log("Warning: nonexistent partium ids will be ignored"),(0,rxjs_1.of)(r.filter((function(r){return!!r})))})),(0,operators_1.catchError)((function(r){return console.log("Error while loading part-information from server.",r),(0,rxjs_1.throwError)(r)})))},t.prototype.getPartsByAssemblyHierarchyNodeId=function(r){return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(part_1.Part.fromAPIResponse,this.httpsService,"part_types",core_1.BACKEND_SERVICE.DATA,[{assembly_uuid:r}],this.PAGINATION_PAGE_SIZE)},t.prototype.getMountingLocationsForPart=function(r,t){return this.httpsService.post("part_types/".concat(r,"/mounting-locations"),__assign({},t&&{priority_locations:t}),[],core_1.BACKEND_SERVICE.DATA).pipe((0,operators_1.map)((function(r){return mounting_location_1.PartMountingLocationInfo.fromAPIResponse(r)})))},t.prototype.loadPartFromServer=function(r,t){var e=[];return(null==t?void 0:t.includeMountingLocations)&&e.push({include_mounting_locations:t.includeMountingLocations}),(null==t?void 0:t.includeSummary)&&e.push({include_summary:t.includeSummary}),(null==t?void 0:t.includeEnrichment)&&e.push({include_enrichment:t.includeEnrichment}),this.httpsService.get("part_types/".concat(r),e,core_1.BACKEND_SERVICE.DATA).pipe((0,operators_1.map)((function(r){return part_1.Part.fromAPIResponse(r)})))},t.prototype.loadPartsFromServer=function(r){var t=this,e=1,o=new rxjs_1.Subject;return(0,rxjs_1.defer)((function(){return t.requestPaginatedParts(r,e)})).pipe((0,operators_1.map)((function(r){var t=r.pagination.page_size,n=r.pagination.items_count,i=Math.ceil(n/t);return e>=i?o.complete():e++<i&&setTimeout((function(){o.next()})),r.results})),(0,operators_1.repeatWhen)((function(){return o.asObservable()})),(0,operators_1.reduce)((function(r,t){return __spreadArray(__spreadArray([],r,!0),t,!0)})),(0,operators_1.map)((function(r){return r.map((function(r){return part_1.Part.fromAPIResponse(r,part_1.DATA_ORIGIN.DATA_API)}))})))},t.prototype.requestPaginatedParts=function(r,t){return this.httpsService.post("part_types/many",{uuids:r},[{page:t},{page_size:this.DOWNLOAD_PAGE_SIZE}],core_1.BACKEND_SERVICE.DATA)},t.prototype.orderParts=function(r,t){for(var e=[],o=function(t){e.push(r.find((function(r){return r&&r.partiumId===t})))},n=0,i=t;n<i.length;n++){o(i[n])}return e},t=__decorate([(0,core_1.InjectionIdentifier)("PartService")],t)}(core_1.BaseService);exports.PartServiceImpl=PartServiceImpl;
|
|
@@ -1,84 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
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.RelatedPartsServiceImpl = void 0;
|
|
26
|
-
var rxjs_1 = require("rxjs");
|
|
27
|
-
var core_1 = require("../../core");
|
|
28
|
-
var part_1 = require("../models/part");
|
|
29
|
-
var RelatedPartsServiceImpl = /** @class */ (function (_super) {
|
|
30
|
-
__extends(RelatedPartsServiceImpl, _super);
|
|
31
|
-
function RelatedPartsServiceImpl(serviceProvider) {
|
|
32
|
-
var _this = _super.call(this, serviceProvider) || this;
|
|
33
|
-
_this.PAGINATION_PAGE_SIZE = 25; // size of page when retrieving page of items and user decides when to load next page
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
RelatedPartsServiceImpl.prototype.onCreate = function () {
|
|
37
|
-
this.httpsService = this.serviceProvider.getService(core_1.HttpsService);
|
|
38
|
-
};
|
|
39
|
-
RelatedPartsServiceImpl.prototype.getSummary = function (partiumPartId) {
|
|
40
|
-
return this.httpsService.get("part_types/".concat(partiumPartId, "/relations-summary"), [], core_1.BACKEND_SERVICE.DATA).pipe((0, rxjs_1.map)(function (response) { return ({
|
|
41
|
-
duplicatesCount: response.duplicates,
|
|
42
|
-
substitutesCount: response.substitutes,
|
|
43
|
-
equivalentsCount: response.equivalents,
|
|
44
|
-
notRelatedCount: response.not_related,
|
|
45
|
-
}); }));
|
|
46
|
-
};
|
|
47
|
-
RelatedPartsServiceImpl.prototype.getRelatedParts = function (partiumPartId, relationTypes, options) {
|
|
48
|
-
var _a;
|
|
49
|
-
var relationTypesArray = Array.isArray(relationTypes) ? relationTypes : [relationTypes];
|
|
50
|
-
var typeMapper = (_a = {},
|
|
51
|
-
_a[part_1.RELATION_TYPE.DUPLICATE] = 'duplicates',
|
|
52
|
-
_a[part_1.RELATION_TYPE.SUBSTITUTE] = 'substitutes',
|
|
53
|
-
_a[part_1.RELATION_TYPE.EQUIVALENT] = 'equivalents',
|
|
54
|
-
_a[part_1.RELATION_TYPE.NOT_RELATED] = 'not_related',
|
|
55
|
-
_a);
|
|
56
|
-
var urlParams = [];
|
|
57
|
-
var mappedRelationTypesArray = relationTypesArray.map(function (relationType) { return typeMapper[relationType]; });
|
|
58
|
-
mappedRelationTypesArray.map(function (relationType) { return urlParams.push({
|
|
59
|
-
relation_types: relationType,
|
|
60
|
-
}); });
|
|
61
|
-
if (options === null || options === void 0 ? void 0 : options.includeAttributes) {
|
|
62
|
-
urlParams.push({ include_attributes: options.includeAttributes });
|
|
63
|
-
}
|
|
64
|
-
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(function (data) {
|
|
65
|
-
var relatedPart = part_1.Part.fromRelatedPartsAPIResponse(data);
|
|
66
|
-
return relatedPart;
|
|
67
|
-
}, this.httpsService, "part_types/".concat(partiumPartId, "/relations"), core_1.BACKEND_SERVICE.DATA, urlParams, this.PAGINATION_PAGE_SIZE, true);
|
|
68
|
-
};
|
|
69
|
-
RelatedPartsServiceImpl.prototype.createPartRelation = function (anchorPartId, relatedPartId, relationType) {
|
|
70
|
-
return this.httpsService.post("part_types/relations", [
|
|
71
|
-
{
|
|
72
|
-
anchor_part_uuid: anchorPartId,
|
|
73
|
-
related_part_uuid: relatedPartId,
|
|
74
|
-
type: relationType,
|
|
75
|
-
},
|
|
76
|
-
], [], core_1.BACKEND_SERVICE.DATA);
|
|
77
|
-
};
|
|
78
|
-
RelatedPartsServiceImpl = __decorate([
|
|
79
|
-
(0, core_1.InjectionIdentifier)('RelatedPartsService')
|
|
80
|
-
], RelatedPartsServiceImpl);
|
|
81
|
-
return RelatedPartsServiceImpl;
|
|
82
|
-
}(core_1.BaseService));
|
|
83
|
-
exports.RelatedPartsServiceImpl = RelatedPartsServiceImpl;
|
|
84
|
-
//# sourceMappingURL=related-parts.service.js.map
|
|
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)}}(),__decorate=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RelatedPartsServiceImpl=void 0;var rxjs_1=require("rxjs"),core_1=require("../../core"),part_1=require("../models/part"),RelatedPartsServiceImpl=function(t){function e(e){var r=t.call(this,e)||this;return r.PAGINATION_PAGE_SIZE=25,r}return __extends(e,t),e.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(core_1.HttpsService)},e.prototype.getSummary=function(t){return this.httpsService.get("part_types/".concat(t,"/relations-summary"),[],core_1.BACKEND_SERVICE.DATA).pipe((0,rxjs_1.map)((function(t){return{duplicatesCount:t.duplicates,substitutesCount:t.substitutes,equivalentsCount:t.equivalents,notRelatedCount:t.not_related}})))},e.prototype.getRelatedParts=function(t,e,r){var o,n=Array.isArray(e)?e:[e],i=((o={})[part_1.RELATION_TYPE.DUPLICATE]="duplicates",o[part_1.RELATION_TYPE.SUBSTITUTE]="substitutes",o[part_1.RELATION_TYPE.EQUIVALENT]="equivalents",o[part_1.RELATION_TYPE.NOT_RELATED]="not_related",o),a=[];return n.map((function(t){return i[t]})).map((function(t){return a.push({relation_types:t})})),(null==r?void 0:r.includeAttributes)&&a.push({include_attributes:r.includeAttributes}),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService((function(t){return part_1.Part.fromRelatedPartsAPIResponse(t)}),this.httpsService,"part_types/".concat(t,"/relations"),core_1.BACKEND_SERVICE.DATA,a,this.PAGINATION_PAGE_SIZE,!0)},e.prototype.createPartRelation=function(t,e,r){return this.httpsService.post("part_types/relations",[{anchor_part_uuid:t,related_part_uuid:e,type:r}],[],core_1.BACKEND_SERVICE.DATA)},e=__decorate([(0,core_1.InjectionIdentifier)("RelatedPartsService")],e)}(core_1.BaseService);exports.RelatedPartsServiceImpl=RelatedPartsServiceImpl;
|
|
@@ -1,153 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
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.ShoppingCartServiceImpl = void 0;
|
|
26
|
-
var rxjs_1 = require("rxjs");
|
|
27
|
-
var operators_1 = require("rxjs/operators");
|
|
28
|
-
var log_1 = require("../../core/models/log");
|
|
29
|
-
var injection_identifier_1 = require("../../core/decorators/injection-identifier");
|
|
30
|
-
var https_service_interface_1 = require("../../core/services/http/https.service.interface");
|
|
31
|
-
var base_service_1 = require("../../core/services/base.service");
|
|
32
|
-
var log_service_1 = require("../../core/services/log.service");
|
|
33
|
-
var shopping_cart_1 = require("../models/shopping-cart");
|
|
34
|
-
var core_1 = require("../../core");
|
|
35
|
-
var csa_request_1 = require("../models/csa-request");
|
|
36
|
-
var ShoppingCartServiceImpl = /** @class */ (function (_super) {
|
|
37
|
-
__extends(ShoppingCartServiceImpl, _super);
|
|
38
|
-
function ShoppingCartServiceImpl(serviceProvider) {
|
|
39
|
-
return _super.call(this, serviceProvider) || this;
|
|
40
|
-
}
|
|
41
|
-
ShoppingCartServiceImpl.prototype.onCreate = function () {
|
|
42
|
-
this.httpsService = this.serviceProvider.getService(https_service_interface_1.HttpsService);
|
|
43
|
-
this.logService = this.serviceProvider.getService(log_service_1.LogServiceImpl);
|
|
44
|
-
};
|
|
45
|
-
ShoppingCartServiceImpl.prototype.getShoppingCarts = function (urlParams) {
|
|
46
|
-
if (urlParams === void 0) { urlParams = []; }
|
|
47
|
-
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromAPIResponse, this.httpsService, "carts", https_service_interface_1.BACKEND_SERVICE.CSA, urlParams);
|
|
48
|
-
};
|
|
49
|
-
ShoppingCartServiceImpl.prototype.createEmptyShoppingCart = function (dto) {
|
|
50
|
-
return this.httpsService.post('carts', dto, [], https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0, operators_1.map)(function (cart) {
|
|
51
|
-
var shoppingCart = shopping_cart_1.ShoppingCart.fromAPIResponse(cart);
|
|
52
|
-
return shoppingCart;
|
|
53
|
-
}));
|
|
54
|
-
};
|
|
55
|
-
ShoppingCartServiceImpl.prototype.getShoppingCart = function (cartId) {
|
|
56
|
-
return this.httpsService.get("carts/".concat(cartId), [], https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0, operators_1.map)(function (cart) {
|
|
57
|
-
var shoppingCart = shopping_cart_1.ShoppingCart.fromAPIResponse(cart);
|
|
58
|
-
return shoppingCart;
|
|
59
|
-
}));
|
|
60
|
-
};
|
|
61
|
-
ShoppingCartServiceImpl.prototype.getShoppingCartParts = function (cartId, urlParams) {
|
|
62
|
-
if (urlParams === void 0) { urlParams = []; }
|
|
63
|
-
return core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromPartAPIResponse, this.httpsService, "carts/".concat(cartId, "/parts"), https_service_interface_1.BACKEND_SERVICE.CSA, urlParams);
|
|
64
|
-
};
|
|
65
|
-
ShoppingCartServiceImpl.prototype.updateShoppingCartPart = function (cartId, updatedPart, shoppingCartEventContext) {
|
|
66
|
-
var _this = this;
|
|
67
|
-
return this.httpsService
|
|
68
|
-
.put("carts/".concat(cartId, "/parts/").concat(updatedPart.item_id), updatedPart, [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
69
|
-
.pipe((0, operators_1.tap)(function () {
|
|
70
|
-
_this.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART, {
|
|
71
|
-
partium_id: updatedPart.item_id,
|
|
72
|
-
quantity: updatedPart.quantity,
|
|
73
|
-
shopping_cart_id: cartId,
|
|
74
|
-
searchSessionId: shoppingCartEventContext === null || shoppingCartEventContext === void 0 ? void 0 : shoppingCartEventContext.searchSessionId,
|
|
75
|
-
}, shoppingCartEventContext);
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
|
-
ShoppingCartServiceImpl.prototype.requestShoppingCartOffer = function (cartId, languageUi) {
|
|
79
|
-
return this.httpsService.post("carts/".concat(cartId, "/actions/request-offer"), { language_ui: languageUi }, [], https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
80
|
-
};
|
|
81
|
-
ShoppingCartServiceImpl.prototype.saveShoppingCartEcrs = function (updatedItems, shoppingCartEventContext) {
|
|
82
|
-
var _this = this;
|
|
83
|
-
var ecrs$ = [];
|
|
84
|
-
updatedItems.forEach(function (item) {
|
|
85
|
-
ecrs$.push(_this.httpsService
|
|
86
|
-
.put("requests/".concat(item.item_id, "/quantity/"), { quantity: item.quantity }, [], https_service_interface_1.BACKEND_SERVICE.CSA)
|
|
87
|
-
.pipe((0, operators_1.map)(function (csaRequestData) { return csa_request_1.CSARequest.fromAPIResponse(csaRequestData); })));
|
|
88
|
-
});
|
|
89
|
-
return (0, rxjs_1.forkJoin)(ecrs$);
|
|
90
|
-
};
|
|
91
|
-
ShoppingCartServiceImpl.prototype.saveShoppingCartParts = function (cartId, updatedParts, shoppingCartEventContext) {
|
|
92
|
-
var updatedItems = updatedParts.map(function (updatedPart) { return ({
|
|
93
|
-
item_id: updatedPart.item_id,
|
|
94
|
-
quantity: updatedPart.quantity,
|
|
95
|
-
bom_context: updatedPart.bom_context,
|
|
96
|
-
}); });
|
|
97
|
-
return this.httpsService.put("carts/".concat(cartId, "/parts"), updatedItems, [], https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
98
|
-
};
|
|
99
|
-
ShoppingCartServiceImpl.prototype.addPart = function (cartId, addedPart, shoppingCartEventContext) {
|
|
100
|
-
var _this = this;
|
|
101
|
-
var addedItem = { item_id: addedPart.item_id, quantity: addedPart.quantity, bom_context: addedPart === null || addedPart === void 0 ? void 0 : addedPart.bom_context };
|
|
102
|
-
return this.httpsService.post("carts/".concat(cartId, "/parts"), addedItem, [], https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0, operators_1.tap)(function () {
|
|
103
|
-
return _this.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART, {
|
|
104
|
-
partiumId: addedPart.item_id,
|
|
105
|
-
quantity: addedPart.quantity,
|
|
106
|
-
searchSessionId: shoppingCartEventContext === null || shoppingCartEventContext === void 0 ? void 0 : shoppingCartEventContext.searchSessionId,
|
|
107
|
-
shopping_cart_id: cartId,
|
|
108
|
-
}, shoppingCartEventContext);
|
|
109
|
-
}));
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Resets the requests list to an empty array of parts.
|
|
113
|
-
*/
|
|
114
|
-
ShoppingCartServiceImpl.prototype.resetShoppingCart = function (cartId, shoppingCartEventContext) {
|
|
115
|
-
var _this = this;
|
|
116
|
-
return this.httpsService.put("carts/".concat(cartId, "/parts"), [], [], https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0, operators_1.tap)(function () {
|
|
117
|
-
_this.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS, { shopping_cart_id: cartId }, shoppingCartEventContext);
|
|
118
|
-
}), (0, operators_1.catchError)(function (error) {
|
|
119
|
-
return;
|
|
120
|
-
}));
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* DELETE a part from request-list without send entire list to update
|
|
124
|
-
*/
|
|
125
|
-
ShoppingCartServiceImpl.prototype.deletePart = function (cartId, partiumId, shoppingCartEventContext) {
|
|
126
|
-
var _this = this;
|
|
127
|
-
return this.httpsService.delete("carts/".concat(cartId, "/parts/").concat(partiumId), {}, [], https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0, operators_1.tap)(function () {
|
|
128
|
-
return _this.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART, { partiumId: partiumId, shopping_cart_id: cartId }, shoppingCartEventContext);
|
|
129
|
-
}), (0, operators_1.map)(function () { return true; }));
|
|
130
|
-
};
|
|
131
|
-
ShoppingCartServiceImpl.prototype.exportShoppingCartAsEmail = function (cartId, recipients, subject, message) {
|
|
132
|
-
return this.httpsService.post("carts/".concat(cartId, "/actions/email"), { recipients: recipients, subject: subject, message: message }, [], https_service_interface_1.BACKEND_SERVICE.CSA);
|
|
133
|
-
};
|
|
134
|
-
ShoppingCartServiceImpl.prototype.dispatchLogService = function (event, data, shoppingCartEventContext) {
|
|
135
|
-
this.logService
|
|
136
|
-
.logEvent(new log_1.EventLog({
|
|
137
|
-
version: log_1.EVENTLOG_VERSIONS.V_2_0_0,
|
|
138
|
-
organizationId: shoppingCartEventContext === null || shoppingCartEventContext === void 0 ? void 0 : shoppingCartEventContext.organizationId,
|
|
139
|
-
interface: (shoppingCartEventContext === null || shoppingCartEventContext === void 0 ? void 0 : shoppingCartEventContext.eventInterface) || log_1.INTERFACE.API_ACCESS,
|
|
140
|
-
event: event,
|
|
141
|
-
data: data,
|
|
142
|
-
}))
|
|
143
|
-
.subscribe(function () { }, function (error) {
|
|
144
|
-
console.log('Error while sending log event: ', error);
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
ShoppingCartServiceImpl = __decorate([
|
|
148
|
-
(0, injection_identifier_1.InjectionIdentifier)('ShoppingCartService')
|
|
149
|
-
], ShoppingCartServiceImpl);
|
|
150
|
-
return ShoppingCartServiceImpl;
|
|
151
|
-
}(base_service_1.BaseService));
|
|
152
|
-
exports.ShoppingCartServiceImpl = ShoppingCartServiceImpl;
|
|
153
|
-
//# sourceMappingURL=shopping-cart.service.js.map
|
|
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 i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__decorate=this&&this.__decorate||function(t,e,r,i){var o,n=arguments.length,c=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(c=(n<3?o(c):n>3?o(e,r,c):o(e,r))||c);return n>3&&c&&Object.defineProperty(e,r,c),c};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShoppingCartServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),log_1=require("../../core/models/log"),injection_identifier_1=require("../../core/decorators/injection-identifier"),https_service_interface_1=require("../../core/services/http/https.service.interface"),base_service_1=require("../../core/services/base.service"),log_service_1=require("../../core/services/log.service"),shopping_cart_1=require("../models/shopping-cart"),core_1=require("../../core"),csa_request_1=require("../models/csa-request"),ShoppingCartServiceImpl=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.onCreate=function(){this.httpsService=this.serviceProvider.getService(https_service_interface_1.HttpsService),this.logService=this.serviceProvider.getService(log_service_1.LogServiceImpl)},e.prototype.getShoppingCarts=function(t){return void 0===t&&(t=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromAPIResponse,this.httpsService,"carts",https_service_interface_1.BACKEND_SERVICE.CSA,t)},e.prototype.createEmptyShoppingCart=function(t){return this.httpsService.post("carts",t,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCart=function(t){return this.httpsService.get("carts/".concat(t),[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return shopping_cart_1.ShoppingCart.fromAPIResponse(t)})))},e.prototype.getShoppingCartParts=function(t,e){return void 0===e&&(e=[]),core_1.PaginatedRequestServiceFactory.generatePaginatedRequestService(shopping_cart_1.ShoppingCart.fromPartAPIResponse,this.httpsService,"carts/".concat(t,"/parts"),https_service_interface_1.BACKEND_SERVICE.CSA,e)},e.prototype.updateShoppingCartPart=function(t,e,r){var i=this;return this.httpsService.put("carts/".concat(t,"/parts/").concat(e.item_id),e,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partium_id:e.item_id,quantity:e.quantity,shopping_cart_id:t,searchSessionId:null==r?void 0:r.searchSessionId},r)})))},e.prototype.requestShoppingCartOffer=function(t,e){return this.httpsService.post("carts/".concat(t,"/actions/request-offer"),{language_ui:e},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.saveShoppingCartEcrs=function(t,e){var r=this,i=[];return t.forEach((function(t){i.push(r.httpsService.put("requests/".concat(t.item_id,"/quantity/"),{quantity:t.quantity},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.map)((function(t){return csa_request_1.CSARequest.fromAPIResponse(t)}))))})),(0,rxjs_1.forkJoin)(i)},e.prototype.saveShoppingCartParts=function(t,e,r){var i=e.map((function(t){return{item_id:t.item_id,quantity:t.quantity,bom_context:t.bom_context}}));return this.httpsService.put("carts/".concat(t,"/parts"),i,[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.addPart=function(t,e,r){var i=this,o={item_id:e.item_id,quantity:e.quantity,bom_context:null==e?void 0:e.bom_context};return this.httpsService.post("carts/".concat(t,"/parts"),o,[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_ADD_PART,{partiumId:e.item_id,quantity:e.quantity,searchSessionId:null==r?void 0:r.searchSessionId,shopping_cart_id:t},r)})))},e.prototype.resetShoppingCart=function(t,e){var r=this;return this.httpsService.put("carts/".concat(t,"/parts"),[],[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){r.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_ALL_PARTS,{shopping_cart_id:t},e)})),(0,operators_1.catchError)((function(t){})))},e.prototype.deletePart=function(t,e,r){var i=this;return this.httpsService.delete("carts/".concat(t,"/parts/").concat(e),{},[],https_service_interface_1.BACKEND_SERVICE.CSA).pipe((0,operators_1.tap)((function(){return i.dispatchLogService(log_1.EVENT.SHOPPING_CART_REMOVE_PART,{partiumId:e,shopping_cart_id:t},r)})),(0,operators_1.map)((function(){return!0})))},e.prototype.exportShoppingCartAsEmail=function(t,e,r,i){return this.httpsService.post("carts/".concat(t,"/actions/email"),{recipients:e,subject:r,message:i},[],https_service_interface_1.BACKEND_SERVICE.CSA)},e.prototype.dispatchLogService=function(t,e,r){this.logService.logEvent(new log_1.EventLog({version:log_1.EVENTLOG_VERSIONS.V_2_0_0,organizationId:null==r?void 0:r.organizationId,interface:(null==r?void 0:r.eventInterface)||log_1.INTERFACE.API_ACCESS,event:t,data:e})).subscribe((function(){}),(function(t){console.log("Error while sending log event: ",t)}))},e=__decorate([(0,injection_identifier_1.InjectionIdentifier)("ShoppingCartService")],e)}(base_service_1.BaseService);exports.ShoppingCartServiceImpl=ShoppingCartServiceImpl;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/image-submission-request"),exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* The content type of a submission image.
|
|
4
|
+
*
|
|
5
|
+
* @see SubmissionImageMetadata
|
|
6
|
+
*/
|
|
7
|
+
export declare enum SubmissionImageContentType {
|
|
8
|
+
/**
|
|
9
|
+
* The part itself.
|
|
10
|
+
*/
|
|
11
|
+
PART = "part",
|
|
12
|
+
/**
|
|
13
|
+
* Part's label, specifications sheet, or similar.
|
|
14
|
+
*/
|
|
15
|
+
SPECIFICATIONS = "specifications",
|
|
16
|
+
/**
|
|
17
|
+
* An assembly, box, etc.
|
|
18
|
+
*/
|
|
19
|
+
OTHER = "other"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Metadata for a submission image.
|
|
23
|
+
*
|
|
24
|
+
* @see ImageSubmissionRequest
|
|
25
|
+
*/
|
|
26
|
+
export interface SubmissionImageMetadata {
|
|
27
|
+
/**
|
|
28
|
+
* The external ID of the part.
|
|
29
|
+
*/
|
|
30
|
+
partId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The content type of the submission image.
|
|
33
|
+
*/
|
|
34
|
+
content: SubmissionImageContentType;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Request for submitting images.
|
|
38
|
+
*
|
|
39
|
+
* @see SubmissionImageMetadata
|
|
40
|
+
*/
|
|
41
|
+
export interface ImageSubmissionRequest {
|
|
42
|
+
/**
|
|
43
|
+
* The organization name.
|
|
44
|
+
*/
|
|
45
|
+
organization: string;
|
|
46
|
+
/**
|
|
47
|
+
* Array of image metadata corresponding to each file
|
|
48
|
+
* The array indices should match between files and images arrays
|
|
49
|
+
*/
|
|
50
|
+
images: SubmissionImageMetadata[];
|
|
51
|
+
/**
|
|
52
|
+
* Array of File objects containing the image data to upload
|
|
53
|
+
*/
|
|
54
|
+
files: File[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
"use strict";var SubmissionImageContentType;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubmissionImageContentType=void 0,function(e){e.PART="part",e.SPECIFICATIONS="specifications",e.OTHER="other"}(SubmissionImageContentType||(exports.SubmissionImageContentType=SubmissionImageContentType={}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
/**
|
|
3
|
+
* A submitted image.
|
|
4
|
+
*
|
|
5
|
+
* @see SubmittedImageResponse
|
|
6
|
+
*/
|
|
7
|
+
export interface SubmittedImage {
|
|
8
|
+
/**
|
|
9
|
+
* The ID of the image.
|
|
10
|
+
*/
|
|
11
|
+
imageId: string;
|
|
12
|
+
/**
|
|
13
|
+
* The ID of the part.
|
|
14
|
+
*/
|
|
15
|
+
partId: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A response containing submitted images.
|
|
19
|
+
*
|
|
20
|
+
* @see SubmittedImage
|
|
21
|
+
*/
|
|
22
|
+
export interface SubmittedImageResponse {
|
|
23
|
+
/**
|
|
24
|
+
* The submitted images.
|
|
25
|
+
*/
|
|
26
|
+
images: SubmittedImage[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { BaseService } from '../../core';
|
|
4
|
+
import { ImageSubmissionRequest } from '../models/image-submission-request';
|
|
5
|
+
import { SubmittedImageResponse } from '../models/submitted-image-response';
|
|
6
|
+
/**
|
|
7
|
+
/**
|
|
8
|
+
* Service for submitting images and metadata to the datacuration backend for AI ingestion.
|
|
9
|
+
*
|
|
10
|
+
* @see ImageSubmissionRequest
|
|
11
|
+
* @see SubmittedImageResponse
|
|
12
|
+
*/
|
|
13
|
+
export interface ImageSubmissionService {
|
|
14
|
+
/**
|
|
15
|
+
* Submits images.
|
|
16
|
+
*
|
|
17
|
+
* @param request - The request containing the images to submit.
|
|
18
|
+
* @returns An Observable that emits the submitted images.
|
|
19
|
+
*/
|
|
20
|
+
submitImages(request: ImageSubmissionRequest): Observable<SubmittedImageResponse>;
|
|
21
|
+
}
|
|
22
|
+
export declare class ImageSubmissionServiceImpl extends BaseService implements ImageSubmissionService {
|
|
23
|
+
private httpsService;
|
|
24
|
+
onCreate(): void;
|
|
25
|
+
submitImages(request: ImageSubmissionRequest): Observable<SubmittedImageResponse>;
|
|
26
|
+
}
|