@partium/js-sdk 14.4.1 → 14.5.1

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 (153) hide show
  1. package/catalog/index.js +1 -21
  2. package/catalog/models/catalog-image-info.js +1 -22
  3. package/catalog/models/catalog-image.js +1 -40
  4. package/catalog/models/upsert-catalog-images-dto.js +1 -3
  5. package/catalog/models/upsert-images-result.js +1 -3
  6. package/catalog/services/images.service.js +1 -62
  7. package/core/constants/constants.d.ts +1 -0
  8. package/core/constants/constants.js +1 -16
  9. package/core/decorators/injection-identifier.js +1 -19
  10. package/core/factories/paginated-request-service.factory.js +1 -33
  11. package/core/index.js +1 -63
  12. package/core/integration-defaults/http/fetch-api-http-error-helper.js +1 -129
  13. package/core/integration-defaults/http/file-transfer/axios-file-transfer.service.js +1 -138
  14. package/core/integration-defaults/http/file-transfer/fetch-api-file-transfer.service.js +1 -210
  15. package/core/integration-defaults/http/handle-axios-error-helper.js +1 -79
  16. package/core/integration-defaults/http/https-client/axios-https-client.service.js +1 -182
  17. package/core/integration-defaults/http/https-client/fetch-api-https-client.service.js +1 -198
  18. package/core/integration-defaults/http/js-oauth-keycloak-https.service.js +1 -32
  19. package/core/integration-defaults/js-p-file.js +1 -36
  20. package/core/integration-defaults/session/js-oauth-api-key-session.service.js +1 -206
  21. package/core/integration-defaults/session/js-oauth-keycloak-auth-config.js +1 -64
  22. package/core/integration-defaults/session/js-oauth-keycloak-session.service.js +1 -257
  23. package/core/integration-defaults/web-device-status.service.js +1 -125
  24. package/core/integration-defaults/web-file.service.js +1 -135
  25. package/core/integration-defaults/web-indexeddb.service.js +1 -142
  26. package/core/integration-defaults/web-local-storage.service.js +1 -310
  27. package/core/models/api-object.js +1 -16
  28. package/core/models/auth-config.js +1 -72
  29. package/core/models/device-info.js +1 -34
  30. package/core/models/error.js +1 -107
  31. package/core/models/formatted-string.js +1 -14
  32. package/core/models/i18n-map.js +1 -61
  33. package/core/models/i18n-string.js +1 -35
  34. package/core/models/log.js +1 -137
  35. package/core/models/organization.js +1 -159
  36. package/core/models/p-file.js +1 -23
  37. package/core/models/paginated-list.js +1 -41
  38. package/core/models/partium-config.js +1 -43
  39. package/core/models/user-token.js +1 -11
  40. package/core/models/user.js +1 -89
  41. package/core/services/backend-status.service.js +1 -147
  42. package/core/services/base-login-init.service.js +1 -57
  43. package/core/services/base.service.js +1 -37
  44. package/core/services/device-status.service.interface.js +1 -117
  45. package/core/services/file.service.interface.js +1 -61
  46. package/core/services/http/file-transfer/file-transfer.service.interface.js +1 -125
  47. package/core/services/http/https-client/https-client.service.interface.js +1 -152
  48. package/core/services/http/https.service.interface.d.ts +3 -1
  49. package/core/services/http/https.service.interface.js +1 -294
  50. package/core/services/http/oauth-https.service.js +1 -218
  51. package/core/services/local-storage.service.interface.js +1 -378
  52. package/core/services/log.service.js +1 -139
  53. package/core/services/organization.service.js +1 -202
  54. package/core/services/paginated-request.service.js +1 -154
  55. package/core/services/recent-parts.service.js +1 -194
  56. package/core/services/service-provider.js +1 -114
  57. package/core/services/session/oauth-session.service.js +1 -104
  58. package/core/services/session/session.service.interface.js +1 -367
  59. package/core/utils/general-helper.js +1 -110
  60. package/data/index.js +1 -44
  61. package/data/models/announcement.js +1 -70
  62. package/data/models/assembly-hierarchy-node-breadcrumb.js +1 -51
  63. package/data/models/assembly-hierarchy-node.js +1 -46
  64. package/data/models/attribute.js +1 -106
  65. package/data/models/csa-request-search.js +1 -46
  66. package/data/models/csa-request-status.js +1 -51
  67. package/data/models/csa-request.js +1 -112
  68. package/data/models/document.js +1 -17
  69. package/data/models/filter-key.js +1 -36
  70. package/data/models/filter-option-value.js +1 -41
  71. package/data/models/image.js +1 -77
  72. package/data/models/inquiry.js +1 -71
  73. package/data/models/mounting-location.js +1 -58
  74. package/data/models/multiple-expert-searches.js +1 -40
  75. package/data/models/part-enrichment-data.js +1 -50
  76. package/data/models/part.d.ts +1 -1
  77. package/data/models/part.js +1 -168
  78. package/data/models/shopping-cart.js +1 -60
  79. package/data/services/announcement.service.js +1 -89
  80. package/data/services/assembly-hierarchy-nodes.service.js +1 -193
  81. package/data/services/csa-helper.service.js +1 -158
  82. package/data/services/customer-service-assistance.service.js +1 -276
  83. package/data/services/filter.service.js +1 -97
  84. package/data/services/inquiry.service.js +1 -68
  85. package/data/services/part-attribute.service.js +1 -118
  86. package/data/services/part-enrichment.service.js +1 -56
  87. package/data/services/part.service.js +1 -182
  88. package/data/services/related-parts.service.js +1 -83
  89. package/data/services/shopping-cart.service.js +1 -152
  90. package/datacuration/index.d.ts +4 -0
  91. package/datacuration/index.js +2 -0
  92. package/datacuration/models/image-submission-request.d.ts +55 -0
  93. package/datacuration/models/image-submission-request.js +2 -0
  94. package/datacuration/models/submitted-image-response.d.ts +27 -0
  95. package/datacuration/models/submitted-image-response.js +2 -0
  96. package/datacuration/services/image-submission.service.d.ts +26 -0
  97. package/datacuration/services/image-submission.service.js +2 -0
  98. package/find/index.js +1 -51
  99. package/find/models/assets/asset.js +1 -32
  100. package/find/models/search-filter.js +1 -205
  101. package/find/models/search-input.js +1 -3
  102. package/find/models/search-output.js +1 -3
  103. package/find/models/search-result-status.js +1 -40
  104. package/find/models/search-session-log-object.js +1 -22
  105. package/find/models/search-status/cv-search-status.js +1 -22
  106. package/find/models/search-status/search-filter-status.js +1 -36
  107. package/find/models/search-status/search-status.js +1 -56
  108. package/find/models/search-status/tag-search-status.js +1 -23
  109. package/find/models/search-status/text-search-status.js +1 -18
  110. package/find/models/search-tag.js +1 -16
  111. package/find/models/smart-filter.js +1 -49
  112. package/find/models/tagable/i18n-tagable.js +1 -37
  113. package/find/models/tagable/tagable-base.js +1 -22
  114. package/find/models/tagable/tagable.js +1 -37
  115. package/find/models/text-search-config.js +1 -70
  116. package/find/models/text-search-manipulator.js +1 -90
  117. package/find/models/text-search-result-item/text-search-error.js +1 -12
  118. package/find/models/text-search-result-item/text-search-result-item-document.js +1 -34
  119. package/find/models/text-search-result-item/text-search-result-item-part.js +1 -36
  120. package/find/models/text-search-result-item/text-search-result-item-recent-query.js +1 -35
  121. package/find/models/text-search-result-item/text-search-result-item-unknown.js +1 -38
  122. package/find/models/text-search-result-item/text-search-result-item.js +1 -22
  123. package/find/services/asset.service.js +1 -348
  124. package/find/services/filter-uploaders/filter-uploader.js +1 -3
  125. package/find/services/filter-uploaders/update-filters-uploader.js +1 -77
  126. package/find/services/filter-uploaders/update-filters.model.js +1 -7
  127. package/find/services/search/cv-search.service.js +1 -214
  128. package/find/services/search/recent-text-search-queries.service.js +1 -260
  129. package/find/services/search/search-result.service.js +1 -539
  130. package/find/services/search/search.service.js +1 -514
  131. package/find/services/search/tag-search.service.js +1 -124
  132. package/find/services/search/text-search.service.js +1 -316
  133. package/find/services/search-filter.service.js +1 -292
  134. package/find/utils/search-helper.js +1 -75
  135. package/gen/sdk-version.d.ts +1 -1
  136. package/gen/sdk-version.js +1 -5
  137. package/index.d.ts +2 -0
  138. package/index.js +1 -392
  139. package/management/index.js +1 -21
  140. package/management/models/api-key-list-response.js +1 -3
  141. package/management/models/api-key-type.js +1 -9
  142. package/management/models/api-key.js +1 -3
  143. package/management/services/api-key.service.js +1 -53
  144. package/ocr/index.js +1 -20
  145. package/ocr/models/detect-response.js +1 -3
  146. package/ocr/models/detected-text-entry.js +1 -3
  147. package/ocr/services/ocr.service.js +1 -59
  148. package/package.json +1 -1
  149. package/user-data/index.js +1 -21
  150. package/user-data/models/part-with-nullable.js +1 -3
  151. package/user-data/models/request-list/request-list.js +1 -63
  152. package/user-data/services/favorite/favorite.service.js +1 -108
  153. package/user-data/services/request-list/request-list.service.js +1 -133
@@ -1,195 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
29
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
30
- step((generator = generator.apply(thisArg, _arguments || [])).next());
31
- });
32
- };
33
- var __generator = (this && this.__generator) || function (thisArg, body) {
34
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
35
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
36
- function verb(n) { return function (v) { return step([n, v]); }; }
37
- function step(op) {
38
- if (f) throw new TypeError("Generator is already executing.");
39
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
40
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
41
- if (y = 0, t) op = [op[0] & 2, t.value];
42
- switch (op[0]) {
43
- case 0: case 1: t = op; break;
44
- case 4: _.label++; return { value: op[1], done: false };
45
- case 5: _.label++; y = op[1]; op = [0]; continue;
46
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
47
- default:
48
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
49
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
50
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
51
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
52
- if (t[2]) _.ops.pop();
53
- _.trys.pop(); continue;
54
- }
55
- op = body.call(thisArg, _);
56
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
57
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
58
- }
59
- };
60
- Object.defineProperty(exports, "__esModule", { value: true });
61
- exports.RecentPartsServiceImpl = void 0;
62
- var rxjs_1 = require("rxjs");
63
- var operators_1 = require("rxjs/operators");
64
- var injection_identifier_1 = require("../decorators/injection-identifier");
65
- var session_service_interface_1 = require("./session/session.service.interface");
66
- var local_storage_service_interface_1 = require("./local-storage.service.interface");
67
- var base_login_init_service_1 = require("./base-login-init.service");
68
- var RecentPartsServiceImpl = /** @class */ (function (_super) {
69
- __extends(RecentPartsServiceImpl, _super);
70
- function RecentPartsServiceImpl(serviceProvider) {
71
- var _this = _super.call(this, serviceProvider) || this;
72
- // promise that resolves as soon as the service initialization is initialized
73
- _this.initialized$ = new Promise(function (resolve, _reject) {
74
- _this.initialized = resolve;
75
- });
76
- _this.recentPartIds$ = new rxjs_1.BehaviorSubject([]);
77
- return _this;
78
- }
79
- RecentPartsServiceImpl.prototype.onCreate = function () {
80
- var _this = this;
81
- this.localStorageService = this.serviceProvider.getService(local_storage_service_interface_1.LocalStorageService);
82
- var sessionService = this.serviceProvider.getService(session_service_interface_1.SessionService);
83
- sessionService
84
- .getSessionStatusEvents()
85
- .subscribe(function (event) {
86
- if (event === session_service_interface_1.SESSION_STATUS_EVENT.SESSION_ENDED) {
87
- _this.reset();
88
- }
89
- });
90
- };
91
- /**
92
- * Initializes the RecentPartsService: Loads the recent parts from the localstorage
93
- * and configures the service based on the passed Partium configuration.
94
- *
95
- * Note: Should be called at the start of a session
96
- * to ensure the correct recent parts are loaded
97
- */
98
- RecentPartsServiceImpl.prototype.init = function (config, userEmail, currentOrganization$) {
99
- var _this = this;
100
- _super.prototype.init.call(this, config, userEmail, currentOrganization$);
101
- this.maxPartHistoryLength = config.recentPartsMaxPartHistoryLength;
102
- // load recent parts on org-switch
103
- this.currentOrganization$.pipe((0, operators_1.filter)(function (organization) { return !!organization; }), (0, operators_1.skip)(1), // skip first loading, as this will already be done during init
104
- (0, operators_1.distinctUntilChanged)()).subscribe(function () {
105
- _this.loadRecentPartIds();
106
- });
107
- return (0, rxjs_1.defer)(function () { return _this.loadRecentPartIds(); }).pipe((0, operators_1.map)(function () {
108
- _this.initialized();
109
- }));
110
- };
111
- RecentPartsServiceImpl.prototype.addRecentPart = function (partiumPartId) {
112
- return __awaiter(this, void 0, void 0, function () {
113
- var recentPartIds;
114
- return __generator(this, function (_a) {
115
- switch (_a.label) {
116
- case 0: return [4 /*yield*/, this.getRecentPartIdsFromLocalStorage()];
117
- case 1:
118
- recentPartIds = _a.sent();
119
- recentPartIds = recentPartIds.filter(function (recentPartId) { return recentPartId !== partiumPartId; });
120
- recentPartIds.unshift(partiumPartId);
121
- recentPartIds = recentPartIds.splice(0, this.maxPartHistoryLength);
122
- return [4 /*yield*/, this.saveToLocalStorage(recentPartIds)];
123
- case 2:
124
- _a.sent();
125
- this.recentPartIds$.next(recentPartIds);
126
- return [2 /*return*/];
127
- }
128
- });
129
- });
130
- };
131
- RecentPartsServiceImpl.prototype.saveToLocalStorage = function (partiumPartIds) {
132
- return __awaiter(this, void 0, void 0, function () {
133
- return __generator(this, function (_a) {
134
- return [2 /*return*/, this.localStorageService.setItem('RECENT_PARTS_IDS', JSON.stringify(partiumPartIds || []))];
135
- });
136
- });
137
- };
138
- RecentPartsServiceImpl.prototype.getRecentParts = function () {
139
- var _this = this;
140
- // wait for the service to be initialized and recent parts are loaded, until recentParts-observable can fire first event
141
- return (0, rxjs_1.from)(this.initialized$).pipe((0, operators_1.mergeMap)(function () { return _this.recentPartIds$.asObservable(); }));
142
- };
143
- RecentPartsServiceImpl.prototype.loadRecentPartIds = function () {
144
- return __awaiter(this, void 0, void 0, function () {
145
- var recentPartIds;
146
- return __generator(this, function (_a) {
147
- switch (_a.label) {
148
- case 0: return [4 /*yield*/, this.getRecentPartIdsFromLocalStorage()];
149
- case 1:
150
- recentPartIds = _a.sent();
151
- this.recentPartIds$.next(recentPartIds);
152
- return [2 /*return*/];
153
- }
154
- });
155
- });
156
- };
157
- /**
158
- * Loads the recent parts from local storage and returns them.
159
- *
160
- * @return array that contains the ids of the recent parts loaded from the localstorage
161
- */
162
- RecentPartsServiceImpl.prototype.getRecentPartIdsFromLocalStorage = function () {
163
- return __awaiter(this, void 0, void 0, function () {
164
- var localStorageEntry, localStoragePartIds;
165
- return __generator(this, function (_a) {
166
- switch (_a.label) {
167
- case 0: return [4 /*yield*/, this.localStorageService.getItem('RECENT_PARTS_IDS')];
168
- case 1:
169
- localStorageEntry = _a.sent();
170
- if (!localStorageEntry) {
171
- return [2 /*return*/, []];
172
- }
173
- localStoragePartIds = JSON.parse(localStorageEntry);
174
- if (!localStoragePartIds || localStoragePartIds.length < 1) {
175
- return [2 /*return*/, []];
176
- }
177
- return [2 /*return*/, localStoragePartIds];
178
- }
179
- });
180
- });
181
- };
182
- /**
183
- * Clear memory (not storage)
184
- * Called on logout.
185
- */
186
- RecentPartsServiceImpl.prototype.reset = function () {
187
- this.recentPartIds$.next([]);
188
- };
189
- RecentPartsServiceImpl = __decorate([
190
- (0, injection_identifier_1.InjectionIdentifier)('RecentPartsService')
191
- ], RecentPartsServiceImpl);
192
- return RecentPartsServiceImpl;
193
- }(base_login_init_service_1.BaseLoginInitService));
194
- exports.RecentPartsServiceImpl = RecentPartsServiceImpl;
195
- //# sourceMappingURL=recent-parts.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 i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RecentPartsServiceImpl=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),injection_identifier_1=require("../decorators/injection-identifier"),session_service_interface_1=require("./session/session.service.interface"),local_storage_service_interface_1=require("./local-storage.service.interface"),base_login_init_service_1=require("./base-login-init.service"),RecentPartsServiceImpl=function(e){function t(t){var r=e.call(this,t)||this;return r.initialized$=new Promise((function(e,t){r.initialized=e})),r.recentPartIds$=new rxjs_1.BehaviorSubject([]),r}return __extends(t,e),t.prototype.onCreate=function(){var e=this;this.localStorageService=this.serviceProvider.getService(local_storage_service_interface_1.LocalStorageService),this.serviceProvider.getService(session_service_interface_1.SessionService).getSessionStatusEvents().subscribe((function(t){t===session_service_interface_1.SESSION_STATUS_EVENT.SESSION_ENDED&&e.reset()}))},t.prototype.init=function(t,r,n){var i=this;return e.prototype.init.call(this,t,r,n),this.maxPartHistoryLength=t.recentPartsMaxPartHistoryLength,this.currentOrganization$.pipe((0,operators_1.filter)((function(e){return!!e})),(0,operators_1.skip)(1),(0,operators_1.distinctUntilChanged)()).subscribe((function(){i.loadRecentPartIds()})),(0,rxjs_1.defer)((function(){return i.loadRecentPartIds()})).pipe((0,operators_1.map)((function(){i.initialized()})))},t.prototype.addRecentPart=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this.getRecentPartIdsFromLocalStorage()];case 1:return(t=(t=r.sent()).filter((function(t){return t!==e}))).unshift(e),t=t.splice(0,this.maxPartHistoryLength),[4,this.saveToLocalStorage(t)];case 2:return r.sent(),this.recentPartIds$.next(t),[2]}}))}))},t.prototype.saveToLocalStorage=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.localStorageService.setItem("RECENT_PARTS_IDS",JSON.stringify(e||[]))]}))}))},t.prototype.getRecentParts=function(){var e=this;return(0,rxjs_1.from)(this.initialized$).pipe((0,operators_1.mergeMap)((function(){return e.recentPartIds$.asObservable()})))},t.prototype.loadRecentPartIds=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getRecentPartIdsFromLocalStorage()];case 1:return e=t.sent(),this.recentPartIds$.next(e),[2]}}))}))},t.prototype.getRecentPartIdsFromLocalStorage=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this.localStorageService.getItem("RECENT_PARTS_IDS")];case 1:return(e=r.sent())?!(t=JSON.parse(e))||t.length<1?[2,[]]:[2,t]:[2,[]]}}))}))},t.prototype.reset=function(){this.recentPartIds$.next([])},t=__decorate([(0,injection_identifier_1.InjectionIdentifier)("RecentPartsService")],t)}(base_login_init_service_1.BaseLoginInitService);exports.RecentPartsServiceImpl=RecentPartsServiceImpl;
@@ -1,115 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";
3
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
5
- if (ar || !(i in from)) {
6
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7
- ar[i] = from[i];
8
- }
9
- }
10
- return to.concat(ar || Array.prototype.slice.call(from));
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.ServiceProvider = void 0;
14
- /**
15
- * Manages and provides all services as singletons.
16
- * If a certain Service is needed somewhere it can be requested here if it is already existing,
17
- * the instance is returned, or if not a new instance is generated.
18
- *
19
- * This Service operates in two stages:
20
- * 1) In the first stage useService can be called, in order to choose which service to use for certain interfaces (eg: HttpsService)
21
- * 2) In the second phase services can be retrieved or created, but not via useService() anymore
22
- * This is required, because services cross-reference each other and this can cause to inconsistencies, especially with services
23
- * that are instantiated via useService, such as HttpsService.
24
- */
25
- var ServiceProvider = /** @class */ (function () {
26
- function ServiceProvider() {
27
- // stores service singletons
28
- this.services = {};
29
- // the use-service-function can only be used in the first phase of the initialization, while
30
- // no services are actually instantiated.
31
- this.useServicePhaseEnded = false;
32
- }
33
- /**
34
- * Get the singleton instance of a certain service class
35
- *
36
- * @param serviceClass the Service-class to get an instance of
37
- * @returns Promise that resoles with singleton instance of the requested service
38
- */
39
- ServiceProvider.prototype.getService = function (serviceClass) {
40
- if (!this.serviceSelectionFinished) {
41
- throw 'Can not retrieve service, because service-selection with useService is not yet finished. Call serviceSelectionFinished to end this phase.';
42
- }
43
- if (!this.services[serviceClass['getInjectionIdentifierName']()]) {
44
- // TODO
45
- this.services[serviceClass['getInjectionIdentifierName']()] = new serviceClass(this); // TODO
46
- if (this.useServicePhaseEnded) {
47
- this.services[serviceClass['getInjectionIdentifierName']()].onCreate(); // TODO
48
- }
49
- }
50
- return this.services[serviceClass['getInjectionIdentifierName']()]; // TODO
51
- };
52
- /**
53
- * Allow to select one specific service out of alternative options.
54
- * eg: HttpsService: There are multiple alternative Https-service,
55
- * which the user of the api can choose from. This function allows
56
- * to choose one and use it over the whole plugin with the unified
57
- * name of it's ancestor.
58
- *
59
- * eg: serviceProvider.useService( HttpsServiceApiKey, HttpsService )
60
- * -> later this can be referred to via serviceProvider.getService( HttpsService )
61
- *
62
- * @param serviceClass the Service-class to use
63
- * @param useFor the super-class to "replace" with
64
- */
65
- ServiceProvider.prototype.useService = function (serviceClass, useFor) {
66
- var initArgs = [];
67
- for (var _i = 2; _i < arguments.length; _i++) {
68
- initArgs[_i - 2] = arguments[_i];
69
- }
70
- if (this.useServicePhaseEnded) {
71
- throw 'You can not call useService after calling serviceSelectionFinished';
72
- }
73
- this.services[useFor['getInjectionIdentifierName']()] = new (serviceClass.bind.apply(serviceClass, __spreadArray([void 0, this], initArgs, false)))(); // TODO
74
- };
75
- /**
76
- * Allows to set an instance for a specified service class
77
- * This can be for example used for setting mocked services in the context of tests
78
- *
79
- * eg: serviceProvider.setService( { ..mocked object }, HttpsService )
80
- *
81
- * @param serviceInstance the service instance to use
82
- * @param useFor the super-class to "replace" with the service instance
83
- */
84
- ServiceProvider.prototype.setService = function (serviceInstance, useFor) {
85
- if (this.useServicePhaseEnded) {
86
- throw 'You can not call setService after calling serviceSelectionFinished';
87
- }
88
- this.services[useFor['getInjectionIdentifierName']()] = serviceInstance;
89
- };
90
- /**
91
- * Call this function when all useService-calls are done to close the 1st stage and allow to use the
92
- * getService method.
93
- */
94
- ServiceProvider.prototype.serviceSelectionFinished = function () {
95
- if (this.useServicePhaseEnded) {
96
- return;
97
- }
98
- this.useServicePhaseEnded = true;
99
- for (var _i = 0, _a = Object.keys(this.services); _i < _a.length; _i++) {
100
- var key = _a[_i];
101
- this.services[key].onCreate();
102
- }
103
- };
104
- /**
105
- * Reset the state of the provider to the initial state.
106
- * (Mainly used for tests)
107
- */
108
- ServiceProvider.prototype.reset = function () {
109
- this.services = {};
110
- this.useServicePhaseEnded = false;
111
- };
112
- return ServiceProvider;
113
- }());
114
- exports.ServiceProvider = ServiceProvider;
115
- //# sourceMappingURL=service-provider.js.map
2
+ "use strict";var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||2===arguments.length)for(var r,s=0,n=i.length;s<n;s++)!r&&s in i||(r||(r=Array.prototype.slice.call(i,0,s)),r[s]=i[s]);return e.concat(r||Array.prototype.slice.call(i))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServiceProvider=void 0;var ServiceProvider=function(){function e(){this.services={},this.useServicePhaseEnded=!1}return e.prototype.getService=function(e){if(!this.serviceSelectionFinished)throw"Can not retrieve service, because service-selection with useService is not yet finished. Call serviceSelectionFinished to end this phase.";return this.services[e.getInjectionIdentifierName()]||(this.services[e.getInjectionIdentifierName()]=new e(this),this.useServicePhaseEnded&&this.services[e.getInjectionIdentifierName()].onCreate()),this.services[e.getInjectionIdentifierName()]},e.prototype.useService=function(e,i){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(this.useServicePhaseEnded)throw"You can not call useService after calling serviceSelectionFinished";this.services[i.getInjectionIdentifierName()]=new(e.bind.apply(e,__spreadArray([void 0,this],t,!1)))},e.prototype.setService=function(e,i){if(this.useServicePhaseEnded)throw"You can not call setService after calling serviceSelectionFinished";this.services[i.getInjectionIdentifierName()]=e},e.prototype.serviceSelectionFinished=function(){if(!this.useServicePhaseEnded){this.useServicePhaseEnded=!0;for(var e=0,i=Object.keys(this.services);e<i.length;e++){var t=i[e];this.services[t].onCreate()}}},e.prototype.reset=function(){this.services={},this.useServicePhaseEnded=!1},e}();exports.ServiceProvider=ServiceProvider;
@@ -1,105 +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
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.OauthSessionService = exports.OauthStatus = exports.OauthLoginConfig = void 0;
20
- var session_service_interface_1 = require("./session.service.interface");
21
- var https_service_interface_1 = require("../http/https.service.interface");
22
- /**
23
- * Configuration that is needed for oauth login.
24
- */
25
- var OauthLoginConfig = /** @class */ (function (_super) {
26
- __extends(OauthLoginConfig, _super);
27
- function OauthLoginConfig(init) {
28
- var _this = _super.call(this) || this;
29
- Object.assign(_this, init);
30
- return _this;
31
- }
32
- return OauthLoginConfig;
33
- }(session_service_interface_1.LoginConfig));
34
- exports.OauthLoginConfig = OauthLoginConfig;
35
- var OauthStatus = /** @class */ (function () {
36
- function OauthStatus(init) {
37
- Object.assign(this, init);
38
- }
39
- return OauthStatus;
40
- }());
41
- exports.OauthStatus = OauthStatus;
42
- /**
43
- * Oauth specific extension of the SessionService, that provides functions
44
- * for oauth-authentication.
45
- * The implementations of this interface will be based on the chosen
46
- * platform that is used in the application,
47
- *
48
- * An implementation of this service is required and has to be configured during
49
- * the initialization phase of Partium.
50
- *
51
- * This class file is called interface, even though it is not an interface,
52
- * but we need it to be a concrete class for the serviceProvider.
53
- */
54
- var OauthSessionService = /** @class */ (function (_super) {
55
- __extends(OauthSessionService, _super);
56
- function OauthSessionService(serviceProvider) {
57
- return _super.call(this, serviceProvider) || this;
58
- }
59
- OauthSessionService.prototype.onCreate = function () {
60
- this.httpsServiceOauth = this.serviceProvider.getService(https_service_interface_1.HttpsService);
61
- };
62
- /**
63
- * Log in the user and will resolve on success, throw an error otherwise
64
- * If an apiKey is passed in the config, the login should be done automatically,
65
- * otherwise the user should be prompted to enter login credentials.
66
- *
67
- * Make sure to call this.sessionSetup() on successful login, to prepare
68
- * the current session.
69
- *
70
- * Method should be overridden by child-class
71
- *
72
- * @param config the LoginConfiguration
73
- * @returns {Observable<void>}
74
- */
75
- OauthSessionService.prototype.login = function (config) {
76
- throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
77
- };
78
- /**
79
- * Refresh the token using the refreshToken. As login, will resolve on success or throw otherwise
80
- *
81
- * Method should be overridden by child-class
82
- */
83
- OauthSessionService.prototype.refresh = function () {
84
- throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
85
- };
86
- /**
87
- * Logout the user and remove all locally stored information. Next login should require the user to enter the credentials
88
- *
89
- * Method should be overridden by child-class
90
- *
91
- * @returns {Observable<void>}
92
- */
93
- OauthSessionService.prototype.logout = function () {
94
- throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().");
95
- };
96
- /**
97
- * Update the oauth token in the oauth https service whenever it changes.
98
- */
99
- OauthSessionService.prototype.tokenUpdated = function (newToken, tokenExpiresAt) {
100
- this.httpsServiceOauth.setToken(newToken, tokenExpiresAt);
101
- };
102
- return OauthSessionService;
103
- }(session_service_interface_1.SessionService));
104
- exports.OauthSessionService = OauthSessionService;
105
- //# sourceMappingURL=oauth-session.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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.OauthSessionService=exports.OauthStatus=exports.OauthLoginConfig=void 0;var session_service_interface_1=require("./session.service.interface"),https_service_interface_1=require("../http/https.service.interface"),OauthLoginConfig=function(e){function t(t){var r=e.call(this)||this;return Object.assign(r,t),r}return __extends(t,e),t}(session_service_interface_1.LoginConfig);exports.OauthLoginConfig=OauthLoginConfig;var OauthStatus=function(e){Object.assign(this,e)};exports.OauthStatus=OauthStatus;var OauthSessionService=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.onCreate=function(){this.httpsServiceOauth=this.serviceProvider.getService(https_service_interface_1.HttpsService)},t.prototype.login=function(e){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.refresh=function(){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.logout=function(){throw new Error("In order to use the OauthSessionService, don't directly use this class, but one of it's descendants, by choosing a replacement with serviceProvider.useService().")},t.prototype.tokenUpdated=function(e,t){this.httpsServiceOauth.setToken(e,t)},t}(session_service_interface_1.SessionService);exports.OauthSessionService=OauthSessionService;