@partium/js-sdk 14.4.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 -164
  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 +2 -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,199 +1,2 @@
1
1
  // Copyright © 2022-2025 Partium, Inc. DBA Partium
2
- "use strict";
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
- var __assign = (this && this.__assign) || function () {
19
- __assign = Object.assign || function(t) {
20
- for (var s, i = 1, n = arguments.length; i < n; i++) {
21
- s = arguments[i];
22
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
23
- t[p] = s[p];
24
- }
25
- return t;
26
- };
27
- return __assign.apply(this, arguments);
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.FetchAPIHttpsClientService = void 0;
31
- var rxjs_1 = require("rxjs");
32
- var operators_1 = require("rxjs/operators");
33
- var fetch_api_http_error_helper_1 = require("../fetch-api-http-error-helper");
34
- var https_client_service_interface_1 = require("../../../services/http/https-client/https-client.service.interface");
35
- var device_status_service_interface_1 = require("../../../services/device-status.service.interface");
36
- var error_1 = require("../../../models/error");
37
- /**
38
- * Implementation of the HttpsClientService for providing basic https calls
39
- * on browsers by using the fetch API.
40
- *
41
- * In an error case all the functions will return an SDK_ERROR_CODE.
42
- */
43
- var FetchAPIHttpsClientService = /** @class */ (function (_super) {
44
- __extends(FetchAPIHttpsClientService, _super);
45
- function FetchAPIHttpsClientService() {
46
- return _super !== null && _super.apply(this, arguments) || this;
47
- }
48
- FetchAPIHttpsClientService.prototype.onCreate = function () {
49
- _super.prototype.onCreate.call(this);
50
- this.deviceStatusService = this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService);
51
- };
52
- /**
53
- * Send GET request to the server with the given url and content.
54
- *
55
- * @param url the full server url
56
- * @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
57
- * @param headers object with the request headers
58
- * @returns Observable that resolves with the request result
59
- */
60
- FetchAPIHttpsClientService.prototype.get = function (url, urlParams, headers) {
61
- return this.requestAsObservable(this.addUrlParameters(url, urlParams), __assign({ method: 'GET' }, (headers && { headers: Object.entries(headers) })));
62
- };
63
- /**
64
- * Send POST request to the server with the given url and content.
65
- *
66
- * @param url the relative server url
67
- * @param data the data to be sent with the post request
68
- * @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
69
- * @param headers object with the request headers
70
- * @returns Observable that resolves with the request result
71
- */
72
- FetchAPIHttpsClientService.prototype.post = function (url, data, urlParams, headers) {
73
- if (data instanceof FormData) {
74
- // remove Content-Type, as it will be automatically set by the browser for FormData body
75
- delete headers['Content-Type'];
76
- }
77
- return this.requestAsObservable(this.addUrlParameters(url, urlParams), __assign(__assign({ method: 'POST' }, (data && { body: this.createBody(data) })), (headers && { headers: Object.entries(headers) })));
78
- };
79
- /**
80
- * Send PATCH request to the server with the given url and content.
81
- *
82
- * @param url the relative server url
83
- * @param data the data to be sent with the patch request
84
- * @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
85
- * @param headers object with the request headers
86
- * @returns Observable that resolves with the request result
87
- */
88
- FetchAPIHttpsClientService.prototype.patch = function (url, data, urlParams, headers) {
89
- return this.requestAsObservable(this.addUrlParameters(url, urlParams), __assign(__assign({ method: 'PATCH' }, (data && { body: this.createBody(data) })), (headers && { headers: Object.entries(headers) })));
90
- };
91
- /**
92
- * Send DELETE request to the server with the given url and content.
93
- *
94
- * @param url the full server url
95
- * @param data the data to be sent with the patch request
96
- * @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
97
- * @param headers object with the request headers
98
- * @returns Observable that resolves with the request result
99
- */
100
- FetchAPIHttpsClientService.prototype.delete = function (url, data, urlParams, headers) {
101
- return this.requestAsObservable(this.addUrlParameters(url, urlParams), __assign(__assign({ method: 'DELETE' }, (data && { body: this.createBody(data) })), (headers && { headers: Object.entries(headers) })));
102
- };
103
- /**
104
- * Send put request to the server with the given url and content.
105
- *
106
- * @param url the full server url
107
- * @param data the data to be sent with the patch request
108
- * @param urlParams array of url parameters (as objects) which will be appended to the url <url>?p1=x&p2=y
109
- * @param headers object with the request headers
110
- * @returns Observable that resolves with the request result
111
- */
112
- FetchAPIHttpsClientService.prototype.put = function (url, data, urlParams, headers) {
113
- return this.requestAsObservable(this.addUrlParameters(url, urlParams), __assign(__assign({ method: 'PUT' }, (data && { body: this.createBody(data) })), (headers && { headers: Object.entries(headers) })));
114
- };
115
- /**
116
- * Wraps the requests with necessary rxjs operators for processing response
117
- * and errors.
118
- *
119
- * @param url the url to request
120
- * @param options options for request, like body or header
121
- * @returns Observable that resolves with the request result
122
- */
123
- FetchAPIHttpsClientService.prototype.requestAsObservable = function (url, options) {
124
- var _this = this;
125
- return new rxjs_1.Observable(function (observer) {
126
- _this.validateIsKnownUrlOrCry(url);
127
- // CWE-918 is a false positive in this case, since we are validating the urls above using `this.validateIsKnownUrlOrCry()`
128
- // which ensures the URL is pointing to one of our services.
129
- // nosemgrep: nodejs_scan.javascript-ssrf-rule-node_ssrf
130
- fetch(url, options)
131
- .then(function (res) {
132
- observer.next(res);
133
- observer.complete();
134
- })
135
- .catch(function (error) {
136
- observer.error(error);
137
- ;
138
- });
139
- })
140
- .pipe((0, operators_1.mergeMap)(function (response) { return _this.processResponse(response); }), (0, operators_1.catchError)(function (error) { return _this.checkInternetConnectivity(error); }), (0, operators_1.catchError)(fetch_api_http_error_helper_1.FetchAPIHttpErrorHelper.processError));
141
- };
142
- /**
143
- * Process successful http-requests.
144
- * Might also throw an error if the response contains a server-side error.
145
- *
146
- * @param result the response of the request
147
- * @returns the requests response-data
148
- */
149
- FetchAPIHttpsClientService.prototype.processResponse = function (result) {
150
- if (!result.status) {
151
- throw result;
152
- }
153
- // CLIENT ERROR
154
- else if (result.status >= 400 && result.status < 500) {
155
- console.log('HttpsService - Client Error');
156
- throw result;
157
- }
158
- // SERVER ERROR
159
- else if (result.status >= 500 && result.status < 600) {
160
- console.log('HttpsService - Server Error');
161
- throw result;
162
- }
163
- // Valid response
164
- else if (result.status === 204) {
165
- return (0, rxjs_1.of)({});
166
- }
167
- else {
168
- return (0, rxjs_1.from)(result.clone().json());
169
- }
170
- };
171
- /**
172
- * Check if there is internet connection and throw a NO_INTERNET, if so.
173
- * Rethrow the original error otherwise.
174
- */
175
- FetchAPIHttpsClientService.prototype.checkInternetConnectivity = function (error) {
176
- return (0, rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0, operators_1.map)(function (connectionStatus) {
177
- if (connectionStatus) {
178
- throw error;
179
- }
180
- else {
181
- throw new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET, error);
182
- }
183
- }));
184
- };
185
- FetchAPIHttpsClientService.prototype.createBody = function (data) {
186
- if (typeof data === 'string') {
187
- return data;
188
- }
189
- if (data instanceof FormData) {
190
- return data;
191
- }
192
- else {
193
- return JSON.stringify(data);
194
- }
195
- };
196
- return FetchAPIHttpsClientService;
197
- }(https_client_service_interface_1.HttpsClientService));
198
- exports.FetchAPIHttpsClientService = FetchAPIHttpsClientService;
199
- //# sourceMappingURL=fetch-api-https-client.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 s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FetchAPIHttpsClientService=void 0;var rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),fetch_api_http_error_helper_1=require("../fetch-api-http-error-helper"),https_client_service_interface_1=require("../../../services/http/https-client/https-client.service.interface"),device_status_service_interface_1=require("../../../services/device-status.service.interface"),error_1=require("../../../models/error"),FetchAPIHttpsClientService=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.deviceStatusService=this.serviceProvider.getService(device_status_service_interface_1.DeviceStatusService)},t.prototype.get=function(e,t,r){return this.requestAsObservable(this.addUrlParameters(e,t),__assign({method:"GET"},r&&{headers:Object.entries(r)}))},t.prototype.post=function(e,t,r,s){return t instanceof FormData&&delete s["Content-Type"],this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"POST"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.patch=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"PATCH"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.delete=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"DELETE"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.put=function(e,t,r,s){return this.requestAsObservable(this.addUrlParameters(e,r),__assign(__assign({method:"PUT"},t&&{body:this.createBody(t)}),s&&{headers:Object.entries(s)}))},t.prototype.requestAsObservable=function(e,t){var r=this;return new rxjs_1.Observable((function(s){r.validateIsKnownUrlOrCry(e),fetch(e,t).then((function(e){s.next(e),s.complete()})).catch((function(e){s.error(e)}))})).pipe((0,operators_1.mergeMap)((function(e){return r.processResponse(e)})),(0,operators_1.catchError)((function(e){return r.checkInternetConnectivity(e)})),(0,operators_1.catchError)(fetch_api_http_error_helper_1.FetchAPIHttpErrorHelper.processError))},t.prototype.processResponse=function(e){if(e.status){if(e.status>=400&&e.status<500)throw console.log("HttpsService - Client Error"),e;if(e.status>=500&&e.status<600)throw console.log("HttpsService - Server Error"),e;return 204===e.status?(0,rxjs_1.of)({}):(0,rxjs_1.from)(e.clone().json())}throw e},t.prototype.checkInternetConnectivity=function(e){return(0,rxjs_1.from)(this.deviceStatusService.isConnectionAvailable()).pipe((0,operators_1.map)((function(t){throw t?e:new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_INTERNET,e)})))},t.prototype.createBody=function(e){return"string"==typeof e||e instanceof FormData?e:JSON.stringify(e)},t}(https_client_service_interface_1.HttpsClientService);exports.FetchAPIHttpsClientService=FetchAPIHttpsClientService;
@@ -1,33 +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.JSOauthKeycloakHttpsService = void 0;
20
- var oauth_https_service_1 = require("../../services/http/oauth-https.service");
21
- /**
22
- * Keycloak-specific implementation of the OauthHttpsService for
23
- * web-based Applications.
24
- */
25
- var JSOauthKeycloakHttpsService = /** @class */ (function (_super) {
26
- __extends(JSOauthKeycloakHttpsService, _super);
27
- function JSOauthKeycloakHttpsService() {
28
- return _super !== null && _super.apply(this, arguments) || this;
29
- }
30
- return JSOauthKeycloakHttpsService;
31
- }(oauth_https_service_1.OauthHttpsService));
32
- exports.JSOauthKeycloakHttpsService = JSOauthKeycloakHttpsService;
33
- //# sourceMappingURL=js-oauth-keycloak-https.service.js.map
2
+ "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JSOauthKeycloakHttpsService=void 0;var oauth_https_service_1=require("../../services/http/oauth-https.service"),JSOauthKeycloakHttpsService=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(oauth_https_service_1.OauthHttpsService);exports.JSOauthKeycloakHttpsService=JSOauthKeycloakHttpsService;
@@ -1,37 +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.JsPFile = void 0;
20
- var p_file_1 = require("../models/p-file");
21
- var JsPFile = /** @class */ (function (_super) {
22
- __extends(JsPFile, _super);
23
- function JsPFile(file) {
24
- var _this = _super.call(this) || this;
25
- _this.file = file;
26
- return _this;
27
- }
28
- JsPFile.prototype.supportsMultipartUpload = function () {
29
- return true;
30
- };
31
- JsPFile.prototype.appendToFormData = function (name, formData) {
32
- formData.append(name, this.file);
33
- };
34
- return JsPFile;
35
- }(p_file_1.PFile));
36
- exports.JsPFile = JsPFile;
37
- //# sourceMappingURL=js-p-file.js.map
2
+ "use strict";var __extends=this&&this.__extends||function(){var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsPFile=void 0;var p_file_1=require("../models/p-file"),JsPFile=function(t){function e(e){var o=t.call(this)||this;return o.file=e,o}return __extends(e,t),e.prototype.supportsMultipartUpload=function(){return!0},e.prototype.appendToFormData=function(t,e){e.append(t,this.file)},e}(p_file_1.PFile);exports.JsPFile=JsPFile;
@@ -1,207 +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.JSOauthPublicApiSessionService = void 0;
20
- var rxjs_1 = require("rxjs");
21
- var oauth_session_service_1 = require("../../services/session/oauth-session.service");
22
- var operators_1 = require("rxjs/operators");
23
- var https_client_service_interface_1 = require("../../services/http/https-client/https-client.service.interface");
24
- var user_1 = require("../../models/user");
25
- var error_1 = require("../../models/error");
26
- var user_token_1 = require("../../models/user-token");
27
- /**
28
- * Public-Api-specific implementation of the OauthSessionService for
29
- * web-based Applications.
30
- */
31
- var JSOauthPublicApiSessionService = /** @class */ (function (_super) {
32
- __extends(JSOauthPublicApiSessionService, _super);
33
- function JSOauthPublicApiSessionService(serviceProvider) {
34
- var _this = _super.call(this, serviceProvider) || this;
35
- _this._status = {
36
- accessToken: undefined,
37
- accessTokenExpiration: undefined,
38
- accessTokenCreateDate: undefined,
39
- authenticated: false,
40
- refreshToken: undefined
41
- };
42
- _this.status$ = new rxjs_1.BehaviorSubject(_this._status);
43
- return _this;
44
- }
45
- /**
46
- * Called when the service is initialized
47
- */
48
- JSOauthPublicApiSessionService.prototype.onCreate = function () {
49
- _super.prototype.onCreate.call(this);
50
- this.httpsClientService = this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService);
51
- };
52
- /**
53
- * Get an observable that always sends the OauthStatus every time
54
- * it changes.
55
- *
56
- * @returns Observable<OauthStatus> observable that resolves with the OauthStatus, every time it changes
57
- */
58
- JSOauthPublicApiSessionService.prototype.getStatus = function () {
59
- return this.status$.asObservable();
60
- };
61
- /**
62
- * Login user and resolves on success
63
- *
64
- * @param config the oauthLoginConfiguration
65
- */
66
- JSOauthPublicApiSessionService.prototype.login = function (config) {
67
- var _this = this;
68
- if (config.activeSession) { // instead of logging in with an api-key, the user already logged in to keycloak via another channel (eg direct)
69
- this.reuseActiveSession(config.activeSession);
70
- return this.sessionSetup();
71
- }
72
- else if (config.apiKey) {
73
- var authConfig = this.authenticationConfig;
74
- return this.httpsClientService.post("".concat(authConfig.partiumApiBaseUrl, "/auth/"), // TODO change back to ".../auth'" (so without tailing slash) as soon as https://partium.atlassian.net/browse/FND-1331 is fixed
75
- null, null, { 'Authorization': "Bearer ".concat(authConfig.apiKey) })
76
- .pipe((0, operators_1.catchError)(function (error) { return _this.handleError(error); }), (0, operators_1.tap)(function (oauthResponse) {
77
- _this.updateTokenFromResponse(oauthResponse);
78
- }), (0, operators_1.mergeMap)(function () {
79
- return _this.sessionSetup();
80
- }));
81
- }
82
- else {
83
- return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_LOGIN_CONFIG, null, 'Neither an api key nor an active session was provided'));
84
- }
85
- };
86
- /**
87
- * Refresh session and Access token with the refresh token
88
- */
89
- JSOauthPublicApiSessionService.prototype.refresh = function () {
90
- var _this = this;
91
- if (this._status && this._status.refreshToken) {
92
- var authConfig = this.authenticationConfig;
93
- return this.httpsClientService.post("".concat(authConfig.partiumApiBaseUrl, "/auth/refresh"), {
94
- refresh_token: this._status.refreshToken
95
- }, null)
96
- .pipe((0, operators_1.catchError)(function (error) { return _this.handleError(error); }), (0, operators_1.map)(function (oauthResponse) {
97
- _this.updateTokenFromResponse(oauthResponse);
98
- }));
99
- }
100
- else {
101
- this.resetToken();
102
- this.sessionEnded();
103
- return (0, rxjs_1.throwError)(this.createSdkError(null, 'Could not refresh because there was no refresh token'));
104
- }
105
- };
106
- /**
107
- * Logout the current user-session
108
- */
109
- JSOauthPublicApiSessionService.prototype.logout = function () {
110
- var _this = this;
111
- if (this._status && this._status.refreshToken) {
112
- var authConfig = this.authenticationConfig;
113
- return this.httpsClientService.post("".concat(authConfig.partiumApiBaseUrl, "/auth/revoke"), {
114
- access_token: this._status.accessToken,
115
- refresh_token: this._status.refreshToken
116
- }, null)
117
- .pipe((0, operators_1.catchError)(function (error) { return _this.handleError(error); }), (0, operators_1.map)(function () {
118
- _this.resetToken();
119
- _this.sessionEnded();
120
- }));
121
- }
122
- else {
123
- this.resetToken();
124
- this.sessionEnded();
125
- return (0, rxjs_1.of)(void 0);
126
- }
127
- };
128
- /**
129
- * Instead of logging in with an api-key, the user already logged in to keycloak via another channel (eg direct)
130
- * -> reuse this existing session instead of creating a new one.
131
- * (Used to prevent that the API-key needs to be exposed in the app and sent to the SDK without encryption)
132
- *
133
- * @param activeSession data about the active session (session-token, ...)
134
- */
135
- JSOauthPublicApiSessionService.prototype.reuseActiveSession = function (activeSession) {
136
- this.updateToken(activeSession);
137
- };
138
- /**
139
- * Update the current access token from a keycloak response.
140
- * Should be called after successful login or refresh
141
- */
142
- JSOauthPublicApiSessionService.prototype.updateTokenFromResponse = function (keycloakResponse) {
143
- var accessTokenExpiration = new Date(Date.now() + (keycloakResponse.expires_in_secs * 1000));
144
- this.updateToken({
145
- accessToken: keycloakResponse.token,
146
- accessTokenExpiration: accessTokenExpiration,
147
- accessTokenCreateDate: new Date(),
148
- authenticated: true,
149
- refreshToken: keycloakResponse.refresh_token
150
- });
151
- };
152
- /**
153
- * Update the current access token
154
- * Should be called after successful login, refresh or session reuse
155
- */
156
- JSOauthPublicApiSessionService.prototype.updateToken = function (sessionStatus) {
157
- this.tokenUpdated(sessionStatus.accessToken, sessionStatus.accessTokenExpiration);
158
- var decodedToken = (0, user_token_1.createUserToken)(sessionStatus.accessToken);
159
- var user = user_1.User.createFromToken(decodedToken);
160
- this.setUser(user);
161
- this._status = sessionStatus;
162
- this.status$.next(this._status);
163
- };
164
- /**
165
- * Reset the current access token
166
- * Called on logout or failing login/refresh
167
- */
168
- JSOauthPublicApiSessionService.prototype.resetToken = function () {
169
- this.tokenUpdated(null, null);
170
- this.setUser(null);
171
- this._status = {
172
- accessToken: undefined,
173
- accessTokenExpiration: undefined,
174
- accessTokenCreateDate: undefined,
175
- authenticated: false,
176
- refreshToken: undefined
177
- };
178
- this.status$.next(this._status);
179
- };
180
- JSOauthPublicApiSessionService.prototype.handleError = function (error) {
181
- if (error instanceof error_1.SdkError) {
182
- if (error.code === error_1.SDK_ERROR_CODES.BAD_REQUEST) {
183
- if (error.detail && error.detail['response'] && error.detail['response']['data']) {
184
- switch (error.detail['response']['data']['error']) {
185
- case 'unauthorized_client':
186
- return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_AUTH_CONFIG, error.detail, 'Unauthorized Keycloak client.'));
187
- }
188
- }
189
- }
190
- // default error handling: if we already receive a SdkError we rethrow it
191
- return (0, rxjs_1.throwError)(error);
192
- }
193
- // if error is not a SdkError we create a a new SdkError with type OAUTH_ERROR
194
- return (0, rxjs_1.throwError)(this.createSdkError(error));
195
- };
196
- /**
197
- * Creates an appropiate SdkError from the input error
198
- * @param error
199
- * @returns SdkError
200
- */
201
- JSOauthPublicApiSessionService.prototype.createSdkError = function (error, msg) {
202
- return new error_1.SdkError(error_1.SDK_ERROR_CODES.OAUTH_ERROR, error, msg);
203
- };
204
- return JSOauthPublicApiSessionService;
205
- }(oauth_session_service_1.OauthSessionService));
206
- exports.JSOauthPublicApiSessionService = JSOauthPublicApiSessionService;
207
- //# sourceMappingURL=js-oauth-api-key-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 s(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JSOauthPublicApiSessionService=void 0;var rxjs_1=require("rxjs"),oauth_session_service_1=require("../../services/session/oauth-session.service"),operators_1=require("rxjs/operators"),https_client_service_interface_1=require("../../services/http/https-client/https-client.service.interface"),user_1=require("../../models/user"),error_1=require("../../models/error"),user_token_1=require("../../models/user-token"),JSOauthPublicApiSessionService=function(e){function t(t){var r=e.call(this,t)||this;return r._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},r.status$=new rxjs_1.BehaviorSubject(r._status),r}return __extends(t,e),t.prototype.onCreate=function(){e.prototype.onCreate.call(this),this.httpsClientService=this.serviceProvider.getService(https_client_service_interface_1.HttpsClientService)},t.prototype.getStatus=function(){return this.status$.asObservable()},t.prototype.login=function(e){var t=this;if(e.activeSession)return this.reuseActiveSession(e.activeSession),this.sessionSetup();if(e.apiKey){var r=this.authenticationConfig;return this.httpsClientService.post("".concat(r.partiumApiBaseUrl,"/auth/"),null,null,{Authorization:"Bearer ".concat(r.apiKey)}).pipe((0,operators_1.catchError)((function(e){return t.handleError(e)})),(0,operators_1.tap)((function(e){t.updateTokenFromResponse(e)})),(0,operators_1.mergeMap)((function(){return t.sessionSetup()})))}return(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_LOGIN_CONFIG,null,"Neither an api key nor an active session was provided"))},t.prototype.refresh=function(){var e=this;if(this._status&&this._status.refreshToken){var t=this.authenticationConfig;return this.httpsClientService.post("".concat(t.partiumApiBaseUrl,"/auth/refresh"),{refresh_token:this._status.refreshToken},null).pipe((0,operators_1.catchError)((function(t){return e.handleError(t)})),(0,operators_1.map)((function(t){e.updateTokenFromResponse(t)})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.throwError)(this.createSdkError(null,"Could not refresh because there was no refresh token"))},t.prototype.logout=function(){var e=this;if(this._status&&this._status.refreshToken){var t=this.authenticationConfig;return this.httpsClientService.post("".concat(t.partiumApiBaseUrl,"/auth/revoke"),{access_token:this._status.accessToken,refresh_token:this._status.refreshToken},null).pipe((0,operators_1.catchError)((function(t){return e.handleError(t)})),(0,operators_1.map)((function(){e.resetToken(),e.sessionEnded()})))}return this.resetToken(),this.sessionEnded(),(0,rxjs_1.of)(void 0)},t.prototype.reuseActiveSession=function(e){this.updateToken(e)},t.prototype.updateTokenFromResponse=function(e){var t=new Date(Date.now()+1e3*e.expires_in_secs);this.updateToken({accessToken:e.token,accessTokenExpiration:t,accessTokenCreateDate:new Date,authenticated:!0,refreshToken:e.refresh_token})},t.prototype.updateToken=function(e){this.tokenUpdated(e.accessToken,e.accessTokenExpiration);var t=(0,user_token_1.createUserToken)(e.accessToken),r=user_1.User.createFromToken(t);this.setUser(r),this._status=e,this.status$.next(this._status)},t.prototype.resetToken=function(){this.tokenUpdated(null,null),this.setUser(null),this._status={accessToken:void 0,accessTokenExpiration:void 0,accessTokenCreateDate:void 0,authenticated:!1,refreshToken:void 0},this.status$.next(this._status)},t.prototype.handleError=function(e){return e instanceof error_1.SdkError?e.code===error_1.SDK_ERROR_CODES.BAD_REQUEST&&e.detail&&e.detail.response&&e.detail.response.data&&"unauthorized_client"===e.detail.response.data.error?(0,rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INVALID_AUTH_CONFIG,e.detail,"Unauthorized Keycloak client.")):(0,rxjs_1.throwError)(e):(0,rxjs_1.throwError)(this.createSdkError(e))},t.prototype.createSdkError=function(e,t){return new error_1.SdkError(error_1.SDK_ERROR_CODES.OAUTH_ERROR,e,t)},t}(oauth_session_service_1.OauthSessionService);exports.JSOauthPublicApiSessionService=JSOauthPublicApiSessionService;
@@ -1,65 +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.JsOauthKeycloakAuthenticationConfig = void 0;
20
- var auth_config_1 = require("../../models/auth-config");
21
- /**
22
- * Authentication configuration for Javascript-Keycloak-OAuth authentication.
23
- */
24
- var JsOauthKeycloakAuthenticationConfig = /** @class */ (function (_super) {
25
- __extends(JsOauthKeycloakAuthenticationConfig, _super);
26
- function JsOauthKeycloakAuthenticationConfig() {
27
- return _super !== null && _super.apply(this, arguments) || this;
28
- }
29
- /**
30
- * Returns the login-url of keycloak for this configured authentication-config.
31
- * Can be used to create a session outside of the SDK and then pass the session into the SDK.
32
- *
33
- * @returns the keycloak login URL
34
- */
35
- JsOauthKeycloakAuthenticationConfig.prototype.getKeycloakLoginUrl = function () {
36
- return "".concat(this.baseUrl, "/auth/realms/").concat(this.realm, "/protocol/openid-connect/token");
37
- };
38
- /**
39
- * Returns the body for a login request against keycloak.
40
- * Can be used to create a session outside of the SDK and then pass the session into the SDK.
41
- *
42
- * @returns the keycloak login request body
43
- */
44
- JsOauthKeycloakAuthenticationConfig.prototype.getKeycloakLoginBody = function () {
45
- return {
46
- client_id: this.clientId,
47
- grant_type: 'password',
48
- scope: 'openid',
49
- };
50
- };
51
- /**
52
- * Returns the header for a login request against keycloak.
53
- * Can be used to create a session outside of the SDK and then pass the session into the SDK.
54
- *
55
- * @returns the keycloak login request header
56
- */
57
- JsOauthKeycloakAuthenticationConfig.prototype.getKeycloakLoginHeader = function () {
58
- return {
59
- 'Content-type': 'application/x-www-form-urlencoded'
60
- };
61
- };
62
- return JsOauthKeycloakAuthenticationConfig;
63
- }(auth_config_1.OauthAuthenticationConfig));
64
- exports.JsOauthKeycloakAuthenticationConfig = JsOauthKeycloakAuthenticationConfig;
65
- //# sourceMappingURL=js-oauth-keycloak-auth-config.js.map
2
+ "use strict";var __extends=this&&this.__extends||function(){var t=function(o,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},t(o,n)};return function(o,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsOauthKeycloakAuthenticationConfig=void 0;var auth_config_1=require("../../models/auth-config"),JsOauthKeycloakAuthenticationConfig=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return __extends(o,t),o.prototype.getKeycloakLoginUrl=function(){return"".concat(this.baseUrl,"/auth/realms/").concat(this.realm,"/protocol/openid-connect/token")},o.prototype.getKeycloakLoginBody=function(){return{client_id:this.clientId,grant_type:"password",scope:"openid"}},o.prototype.getKeycloakLoginHeader=function(){return{"Content-type":"application/x-www-form-urlencoded"}},o}(auth_config_1.OauthAuthenticationConfig);exports.JsOauthKeycloakAuthenticationConfig=JsOauthKeycloakAuthenticationConfig;