@partium/js-sdk 14.0.3 → 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.
Files changed (142) hide show
  1. package/catalog/index.js +21 -1
  2. package/catalog/models/catalog-image-info.js +22 -1
  3. package/catalog/models/catalog-image.js +40 -1
  4. package/catalog/models/upsert-catalog-images-dto.js +3 -1
  5. package/catalog/models/upsert-images-result.js +3 -1
  6. package/catalog/services/images.service.js +62 -1
  7. package/core/constants/constants.js +16 -1
  8. package/core/decorators/injection-identifier.js +19 -1
  9. package/core/factories/paginated-request-service.factory.js +33 -1
  10. package/core/index.js +63 -1
  11. package/core/integration-defaults/http/fetch-api-http-error-helper.js +129 -1
  12. package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +138 -1
  13. package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +210 -1
  14. package/core/integration-defaults/http/handle-axios-error-helper.js +79 -1
  15. package/core/integration-defaults/http/https-client/axios-https-client.service.js +182 -1
  16. package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +198 -1
  17. package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +32 -1
  18. package/core/integration-defaults/js-p-file.js +36 -1
  19. package/core/integration-defaults/session/js-oauth-api-key-session.service.js +206 -1
  20. package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +64 -1
  21. package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +257 -1
  22. package/core/integration-defaults/web-device-status.service.js +125 -1
  23. package/core/integration-defaults/web-file.service.js +135 -1
  24. package/core/integration-defaults/web-indexeddb.service.js +142 -1
  25. package/core/integration-defaults/web-local-storage.service.js +310 -1
  26. package/core/models/api-object.js +16 -1
  27. package/core/models/auth-config.js +72 -1
  28. package/core/models/device-info.js +34 -1
  29. package/core/models/error.js +107 -1
  30. package/core/models/formatted-string.js +14 -1
  31. package/core/models/i18n-map.js +61 -1
  32. package/core/models/i18n-string.js +35 -1
  33. package/core/models/log.js +137 -1
  34. package/core/models/organization.js +159 -1
  35. package/core/models/p-file.js +23 -1
  36. package/core/models/paginated-list.js +41 -1
  37. package/core/models/partium-config.js +43 -1
  38. package/core/models/user-token.js +11 -1
  39. package/core/models/user.js +88 -1
  40. package/core/services/backend-status.service.js +147 -1
  41. package/core/services/base-login-init.service.js +57 -1
  42. package/core/services/base.service.js +37 -1
  43. package/core/services/device-status.service.interface.js +117 -1
  44. package/core/services/file.service.interface.js +61 -1
  45. package/core/services/http/file-transfer/file-transfer.service.interface.js +125 -1
  46. package/core/services/http/https-client/https-client.service.interface.js +152 -1
  47. package/core/services/http/https.service.interface.js +294 -1
  48. package/core/services/http/oauth-https.service.js +218 -1
  49. package/core/services/local-storage.service.interface.js +378 -1
  50. package/core/services/log.service.js +139 -1
  51. package/core/services/organization.service.js +202 -1
  52. package/core/services/paginated-request.service.js +160 -1
  53. package/core/services/recent-parts.service.js +194 -1
  54. package/core/services/service-provider.js +114 -1
  55. package/core/services/session/oauth-session.service.js +104 -1
  56. package/core/services/session/session.service.interface.js +367 -1
  57. package/core/utils/general-helper.js +110 -1
  58. package/data/index.js +44 -1
  59. package/data/models/announcement.js +70 -1
  60. package/data/models/assembly-hierarchy-node-breadcrumb.js +51 -1
  61. package/data/models/assembly-hierarchy-node.js +46 -1
  62. package/data/models/attribute.js +106 -1
  63. package/data/models/csa-request-search.js +46 -1
  64. package/data/models/csa-request-status.js +51 -1
  65. package/data/models/csa-request.js +112 -1
  66. package/data/models/document.js +17 -1
  67. package/data/models/filter-key.js +36 -1
  68. package/data/models/filter-option-value.js +41 -1
  69. package/data/models/image.d.ts +3 -1
  70. package/data/models/image.js +77 -1
  71. package/data/models/inquiry.js +71 -1
  72. package/data/models/mounting-location.js +58 -1
  73. package/data/models/multiple-expert-searches.js +40 -1
  74. package/data/models/part-enrichment-data.js +50 -1
  75. package/data/models/part.js +168 -1
  76. package/data/models/shopping-cart.js +60 -1
  77. package/data/services/announcement.service.js +89 -1
  78. package/data/services/assembly-hierarchy-nodes.service.js +193 -1
  79. package/data/services/csa-helper.service.js +158 -1
  80. package/data/services/customer-service-assistance.service.js +276 -1
  81. package/data/services/filter.service.js +97 -1
  82. package/data/services/inquiry.service.js +68 -1
  83. package/data/services/part-attribute.service.js +118 -1
  84. package/data/services/part-enrichment.service.js +56 -1
  85. package/data/services/part.service.js +182 -1
  86. package/data/services/related-parts.service.js +83 -1
  87. package/data/services/shopping-cart.service.js +152 -1
  88. package/find/index.js +51 -1
  89. package/find/models/assets/asset.js +32 -1
  90. package/find/models/search-filter.js +205 -1
  91. package/find/models/search-input.js +3 -1
  92. package/find/models/search-output.js +3 -1
  93. package/find/models/search-result-status.js +40 -1
  94. package/find/models/search-session-log-object.js +22 -1
  95. package/find/models/search-status/cv-search-status.js +22 -1
  96. package/find/models/search-status/search-filter-status.js +36 -1
  97. package/find/models/search-status/search-status.js +56 -1
  98. package/find/models/search-status/tag-search-status.js +23 -1
  99. package/find/models/search-status/text-search-status.js +18 -1
  100. package/find/models/search-tag.js +16 -1
  101. package/find/models/smart-filter.js +49 -1
  102. package/find/models/tagable/i18n-tagable.js +37 -1
  103. package/find/models/tagable/tagable-base.js +22 -1
  104. package/find/models/tagable/tagable.js +37 -1
  105. package/find/models/text-search-config.js +70 -1
  106. package/find/models/text-search-manipulator.js +90 -1
  107. package/find/models/text-search-result-item/text-search-error.js +12 -1
  108. package/find/models/text-search-result-item/text-search-result-item-document.js +34 -1
  109. package/find/models/text-search-result-item/text-search-result-item-part.js +36 -1
  110. package/find/models/text-search-result-item/text-search-result-item-recent-query.js +35 -1
  111. package/find/models/text-search-result-item/text-search-result-item-unknown.js +38 -1
  112. package/find/models/text-search-result-item/text-search-result-item.js +22 -1
  113. package/find/services/asset.service.js +348 -1
  114. package/find/services/filter-uploaders/filter-uploader.js +3 -1
  115. package/find/services/filter-uploaders/update-filters-uploader.js +77 -1
  116. package/find/services/filter-uploaders/update-filters.model.js +7 -1
  117. package/find/services/search/cv-search.service.js +214 -1
  118. package/find/services/search/recent-text-search-queries.service.js +260 -1
  119. package/find/services/search/search-result.service.js +539 -1
  120. package/find/services/search/search.service.js +514 -1
  121. package/find/services/search/tag-search.service.js +124 -1
  122. package/find/services/search/text-search.service.js +316 -1
  123. package/find/services/search-filter.service.js +292 -1
  124. package/find/utils/search-helper.js +75 -1
  125. package/gen/sdk-version.d.ts +1 -1
  126. package/gen/sdk-version.js +5 -1
  127. package/index.js +392 -1
  128. package/management/index.js +21 -1
  129. package/management/models/api-key-list-response.js +3 -1
  130. package/management/models/api-key-type.js +9 -1
  131. package/management/models/api-key.js +3 -1
  132. package/management/services/api-key.service.js +53 -1
  133. package/ocr/index.js +20 -1
  134. package/ocr/models/detect-response.js +3 -1
  135. package/ocr/models/detected-text-entry.js +3 -1
  136. package/ocr/services/ocr.service.js +59 -1
  137. package/package.json +1 -1
  138. package/user-data/index.js +21 -1
  139. package/user-data/models/part-with-nullable.js +3 -1
  140. package/user-data/models/request-list/request-list.js +63 -1
  141. package/user-data/services/favorite/favorite.service.js +108 -1
  142. package/user-data/services/request-list/request-list.service.js +133 -1
@@ -1,2 +1,57 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function 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;
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
@@ -1,2 +1,183 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
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;
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
@@ -1,2 +1,84 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__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;
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
@@ -1,2 +1,153 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function 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;
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
package/find/index.js CHANGED
@@ -1,2 +1,52 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,s){void 0===s&&(s=t);var a=Object.getOwnPropertyDescriptor(r,t);a&&!("get"in a?!r.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,s,a)}:function(e,r,t,s){void 0===s&&(s=t),e[s]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./models/tagable/i18n-tagable"),exports),__exportStar(require("./models/tagable/tagable-base"),exports),__exportStar(require("./models/tagable/tagable"),exports),__exportStar(require("./models/text-search-result-item/text-search-result-item-unknown"),exports),__exportStar(require("./models/text-search-result-item/text-search-result-item-part"),exports),__exportStar(require("./models/text-search-result-item/text-search-result-item-document"),exports),__exportStar(require("./models/text-search-result-item/text-search-result-item-recent-query"),exports),__exportStar(require("./models/text-search-result-item/text-search-error"),exports),__exportStar(require("./models/text-search-result-item/text-search-result-item"),exports),__exportStar(require("./models/smart-filter"),exports),__exportStar(require("./models/search-status/text-search-status"),exports),__exportStar(require("./models/search-status/cv-search-status"),exports),__exportStar(require("./models/search-status/search-filter-status"),exports),__exportStar(require("./models/search-status/search-status"),exports),__exportStar(require("./models/search-status/tag-search-status"),exports),__exportStar(require("./models/search-filter"),exports),__exportStar(require("./models/text-search-manipulator"),exports),__exportStar(require("./models/assets/asset"),exports),__exportStar(require("./models/text-search-config"),exports),__exportStar(require("./models/search-session-log-object"),exports),__exportStar(require("./models/search-tag"),exports),__exportStar(require("./models/search-result-status"),exports),__exportStar(require("./models/search-input"),exports),__exportStar(require("./models/search-output"),exports),__exportStar(require("./services/search-filter.service"),exports),__exportStar(require("./services/search/search.service"),exports),__exportStar(require("./services/search/search-result.service"),exports),__exportStar(require("./services/search/text-search.service"),exports),__exportStar(require("./services/search/cv-search.service"),exports),__exportStar(require("./services/filter-uploaders/filter-uploader"),exports),__exportStar(require("./services/filter-uploaders/update-filters-uploader"),exports),__exportStar(require("./services/asset.service"),exports),__exportStar(require("./services/search/tag-search.service"),exports),__exportStar(require("./services/search/recent-text-search-queries.service"),exports);
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./models/tagable/i18n-tagable"), exports);
19
+ __exportStar(require("./models/tagable/tagable-base"), exports);
20
+ __exportStar(require("./models/tagable/tagable"), exports);
21
+ __exportStar(require("./models/text-search-result-item/text-search-result-item-unknown"), exports);
22
+ __exportStar(require("./models/text-search-result-item/text-search-result-item-part"), exports);
23
+ __exportStar(require("./models/text-search-result-item/text-search-result-item-document"), exports);
24
+ __exportStar(require("./models/text-search-result-item/text-search-result-item-recent-query"), exports);
25
+ __exportStar(require("./models/text-search-result-item/text-search-error"), exports);
26
+ __exportStar(require("./models/text-search-result-item/text-search-result-item"), exports);
27
+ __exportStar(require("./models/smart-filter"), exports);
28
+ __exportStar(require("./models/search-status/text-search-status"), exports);
29
+ __exportStar(require("./models/search-status/cv-search-status"), exports);
30
+ __exportStar(require("./models/search-status/search-filter-status"), exports);
31
+ __exportStar(require("./models/search-status/search-status"), exports);
32
+ __exportStar(require("./models/search-status/tag-search-status"), exports);
33
+ __exportStar(require("./models/search-filter"), exports);
34
+ __exportStar(require("./models/text-search-manipulator"), exports);
35
+ __exportStar(require("./models/assets/asset"), exports);
36
+ __exportStar(require("./models/text-search-config"), exports);
37
+ __exportStar(require("./models/search-session-log-object"), exports);
38
+ __exportStar(require("./models/search-tag"), exports);
39
+ __exportStar(require("./models/search-result-status"), exports);
40
+ __exportStar(require("./models/search-input"), exports);
41
+ __exportStar(require("./models/search-output"), exports);
42
+ __exportStar(require("./services/search-filter.service"), exports);
43
+ __exportStar(require("./services/search/search.service"), exports);
44
+ __exportStar(require("./services/search/search-result.service"), exports);
45
+ __exportStar(require("./services/search/text-search.service"), exports);
46
+ __exportStar(require("./services/search/cv-search.service"), exports);
47
+ __exportStar(require("./services/filter-uploaders/filter-uploader"), exports);
48
+ __exportStar(require("./services/filter-uploaders/update-filters-uploader"), exports);
49
+ __exportStar(require("./services/asset.service"), exports);
50
+ __exportStar(require("./services/search/tag-search.service"), exports);
51
+ __exportStar(require("./services/search/recent-text-search-queries.service"), exports);
52
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,33 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";var ASSET_STATUS;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Asset=exports.ASSET_STATUS=void 0,function(t){t[t.NEW=0]="NEW",t[t.PREPARING=1]="PREPARING",t[t.PREPARED=2]="PREPARED",t[t.UPLOADING=3]="UPLOADING",t[t.UPLOADED=4]="UPLOADED",t[t.VERIFYING=5]="VERIFYING",t[t.VERIFIED=6]="VERIFIED",t[t.ERROR=7]="ERROR"}(ASSET_STATUS||(exports.ASSET_STATUS=ASSET_STATUS={}));var Asset=function(){function t(t){this.file=t,this.status=ASSET_STATUS.NEW}return t.prototype.setStatus=function(t){this.status=t},t.prototype.getStatus=function(){return this.status},t}();exports.Asset=Asset;
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Asset = exports.ASSET_STATUS = void 0;
5
+ var ASSET_STATUS;
6
+ (function (ASSET_STATUS) {
7
+ ASSET_STATUS[ASSET_STATUS["NEW"] = 0] = "NEW";
8
+ ASSET_STATUS[ASSET_STATUS["PREPARING"] = 1] = "PREPARING";
9
+ ASSET_STATUS[ASSET_STATUS["PREPARED"] = 2] = "PREPARED";
10
+ ASSET_STATUS[ASSET_STATUS["UPLOADING"] = 3] = "UPLOADING";
11
+ ASSET_STATUS[ASSET_STATUS["UPLOADED"] = 4] = "UPLOADED";
12
+ ASSET_STATUS[ASSET_STATUS["VERIFYING"] = 5] = "VERIFYING";
13
+ ASSET_STATUS[ASSET_STATUS["VERIFIED"] = 6] = "VERIFIED";
14
+ ASSET_STATUS[ASSET_STATUS["ERROR"] = 7] = "ERROR"; // an error occurred
15
+ })(ASSET_STATUS || (exports.ASSET_STATUS = ASSET_STATUS = {}));
16
+ /**
17
+ * Asset of any type that exists in the Partium ecosystem.
18
+ */
19
+ var Asset = /** @class */ (function () {
20
+ function Asset(file) {
21
+ this.file = file;
22
+ this.status = ASSET_STATUS.NEW;
23
+ }
24
+ Asset.prototype.setStatus = function (newStatus) {
25
+ this.status = newStatus;
26
+ };
27
+ Asset.prototype.getStatus = function () {
28
+ return this.status;
29
+ };
30
+ return Asset;
31
+ }());
32
+ exports.Asset = Asset;
33
+ //# sourceMappingURL=asset.js.map